<html>
<head>
  <title>15-Explain详解</title>
  <basefont face="微软雅黑" size="2" />
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  <meta name="exporter-version" content="YXBJ Windows/600646 (zh-CN, DDL); Windows/6.1.1 (Win64);"/>
  <meta name="content-class" content="yinxiang.markdown"/>
  <style>
    body, td {
      font-family: 微软雅黑;
      font-size: 10pt;
    }
  </style>
</head>
<body>
<a name="825"/>
<h1>15-Explain详解</h1>

<div><span><div style="font-size: 14px; margin: 0; padding: 0; width: 100%;"><p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">一条查询语句在经过MySQL查询优化器的各种基于成本和规则的优化会后生成一个所谓的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">执行计划</strong>，通过EXPLAIN语句可以查看具体的执比较一条查询语句在经过MySQL查询优化器的各种基于成本和规则的优化会后生成一个所谓的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">执行计划</strong>，通过EXPLAIN语句可以查看具体的执行计划。</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">执行计划里的输出项大致如下：<br/>
<img src="15-Explain详解_files/Image.png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;"><img src="15-Explain详解_files/Image [1].png" type="image/png" data-filename="Image.png"/><br/>
假设有2个和single_table表结构一样的s1、s2表，而且这两张表里有10000条记录，除id列外其他的列都插入随机值。</p>
<h2 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 34px; border-bottom: 1px solid #dbdbdb; color: #333;">执行计划输出中各列详解</h2>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">table</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">无论查询语句有多复杂，包含多少张表，最后也是需要对每个表进行单表访问的，所以MySQL规定，EXPLAIN语句输出的每条记录都对应着某个单表的访问方法，该条记录的table列代表着该表的表名。<img src="15-Explain详解_files/Image [2].png" type="image/png" data-filename="Image.png"/></p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">id</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">查询语句中每出现一个SELECT关键字，MySQL就会为它分配一个唯一的id值。</p>
<ol style="line-height: 160%; box-sizing: content-box; display: block; padding-left: 30px; margin: 6px 0 10px; color: #333; list-style-type: decimal;">
<li style="line-height: 160%; box-sizing: content-box;">
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">连接查询</strong><br/>
对于<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">连接查询</strong>来说，一个SELECT关键字后边的FROM子句中可以跟随多个表，所以在连接查询的执行计划中，<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">每个表都会对应一条记录，但是这些记录的id值都是相同的</strong>，比如：<br/>
<img src="15-Explain详解_files/Image [3].png" type="image/png" data-filename="Image.png"/><br/>
<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">在连接查询的执行计划中，每个表都会对应一条记录，这些记录的id列的值是相同的，出现在前边的表表示驱动表，出现在后边的表表示被驱动表。</strong></p>
</li>
<li style="line-height: 160%; box-sizing: content-box;">
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">子查询<br/>
对于<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">包含子查询的查询语句</strong>来说，就可能涉及多个SELECT关键字，所以在包含子查询的查询语句的执行计划中，<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">每个SELECT关键字都会对应一个唯一的id值</strong>，比如这样：<img src="15-Explain详解_files/Image [4].png" type="image/png" data-filename="Image.png"/><br/>
但是这里需要特别注意，<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">查询优化器可能对涉及子查询的查询语句进行重写，从而转换为连接查询</strong>。所以如果我们想知道查询优化器对某个包含子查询的语句是否进行了重写，直接查看执行计划就好了，比如说：<img src="15-Explain详解_files/Image [5].png" type="image/png" data-filename="Image.png"/></p>
</li>
<li style="line-height: 160%; box-sizing: content-box;">
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">union查询<br/>
对于包含UNION子句的查询语句来说，每个SELECT关键字对应一个id值也是没错的，不过还是有点儿特别的东西，比方说下边这个查询：<img src="15-Explain详解_files/Image [6].png" type="image/png" data-filename="Image.png"/><br/>
正如上边的查询计划中所示，UNION子句是为了把id为1的查询和id为2的查询的结果集合并起来并去重，所以在内部创建了一个名为&lt;union1, 2&gt;的临时表（就是执行计划第三条记录的table列的名称），id为NULL表明这个临时表是为了合并两个查询的结果集而创建的。<br/>
跟UNION对比起来，UNION ALL就不需要为最终的结果集进行去重，它只是单纯的把多个查询的结果集中的记录合并成一个并返回给用户，所以也就不需要使用临时表。所以在包含UNION ALL子句的查询的执行计划中，就没有那个id为NULL的记录。</p>
</li>
</ol>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">select_type</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">通过select_type可以知道小查询在整个大查询中扮演了一个什么样的角色：<br/>
<img src="15-Explain详解_files/Image [7].png" type="image/png" data-filename="Image.png"/></p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">SIMPLE</strong><br/>
查询语句中<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">不包含</strong>UNION或者子查询的查询都算是<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">SIMPLE</strong>类型。当然，连接查询也算是SIMPLE类型。</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">PRIMARY</strong><br/>
对于包含UNION、UNION ALL或者子查询的大查询来说，它是由几个小查询组成的，其中最左边的那个查询的select_type值就是PRIMARY。</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">UNION</strong><br/>
对于包含UNION或者UNION ALL的大查询来说，它是由几个小查询</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">UNION RESULT</strong><br/>
MySQL选择使用临时表来完成UNION查询的去重工作，针对该临时表的查询的select_type就是UNION RESULT。</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">SUBQUERY</strong><br/>
如果<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">包含子查询的查询语句不能够转为对应的semi-join的形式，并且该子查询是不相关子查询，并且查询优化器决定采用将该子查询物化的方案来执行该子查询</strong>时，该子查询的第一个SELECT关键字代表的那个查询的select_type就是<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">SUBQUERY</strong>，比如下边这个查询：<img src="15-Explain详解_files/Image [8].png" type="image/png" data-filename="Image.png"/><br/>
可以看到，外层查询的select_type就是PRIMARY，子查询的select_type就是SUBQUERY。需要注意的是，<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">由于select_type为SUBQUERY的子查询由于会被物化，所以只需要执行一遍</strong>。</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">DEPENDENT SUBQUERY</strong><br/>
如果<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">包含子查询的查询语句不能够转为对应的semi-join的形式，并且该子查询是相关子查询</strong>，则该子查询的第一个SELECT关键字代表的那个查询的select_type就是<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">DEPENDENT SUBQUERY</strong>，比如下边这个查询：<img src="15-Explain详解_files/Image [9].png" type="image/png" data-filename="Image.png"/><br/>
需要注意的是，<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">select_type为DEPENDENT SUBQUERY的查询可能会被执行多次。</strong></p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">DEPENDENT UNION</strong><br/>
在<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">包含UNION或者UNION ALL的大查询中，如果各个小查询都依赖于外层查询的话，那除了最左边的那个小查询之外，其余的小查询的select_type的值就是DEPENDENT UNION</strong>。说的有些绕哈，比方说下边这个查询：<br/>
EXPLAIN SELECT * FROM s1 WHERE key1 IN (SELECT key1 FROM s2 WHERE key1 = 'a' UNION SELECT key1 FROM s1 WHERE key1 = 'b');<img src="15-Explain详解_files/Image [10].png" type="image/png" data-filename="Image.png"/><br/>
这个查询比较复杂啊，大查询里包含了一个子查询，子查询里又是由UNION连起来的两个小查询。从执行计划中可以看出来，SELECT key1 FROM s2 WHERE key1 = 'a'这个小查询由于是子查询中第一个查询，所以它的select_type是DEPENDENT SUBQUERY，而SELECT key1 FROM s1 WHERE key1 = 'b'这个查询的select_type就是DEPENDENT UNION。</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">DERIVED</strong><br/>
对于采用物化的方式执行的包含派生表的查询：<br/>
<img src="15-Explain详解_files/Image [11].png" type="image/png" data-filename="Image.png"/><br/>
如果派生表可以通过和外层查询合并的方式执行的话，执行计划又是另一番景象。</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">MATERIALIZED</strong><br/>
当查询优化器在执行包含子查询的语句时，选择将子查询物化之后再与外层查询进行连接查询，该子查询对应的select_type就是MATERIALIZED（是semi-join的一种）：<br/>
<img src="15-Explain详解_files/Image [12].png" type="image/png" data-filename="Image.png"/></p>
</li>
</ul>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">type</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">type代表对某个表的执行查询时的访问方法。完整的访问方法如下：<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">system，const，eq_ref，ref，fulltext，ref_or_null，index_merge，unique_subquery，index_subquery，range，index，ALL。</strong></p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">system</strong><br/>
当表中只有一条记录并且该表使用的存储引擎的统计数据是精确的，比如MyISAM、Memory，那么对该表的访问方法就是system。<br/>
<img src="15-Explain详解_files/Image [13].png" type="image/png" data-filename="Image.png"/></p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">const</strong><br/>
根据主键或者唯一二级索引列与常数进行等值（NULL值特殊）匹配时，对单表的访问方法就是const。<img src="15-Explain详解_files/Image [14].png" type="image/png" data-filename="Image.png"/></p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">eq_ref</strong><br/>
在<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">连接查询</strong>时，如果被驱动表是通过主键或者唯一二级索引列等值（NULL值特殊）匹配的方式进行访问的（如果该主键或者唯一二级索引是联合索引的话，所有的索引列都必须进行等值比较），则对该被驱动表的访问方法就是eq_ref，比方说：<img src="15-Explain详解_files/Image [15].png" type="image/png" data-filename="Image.png"/></p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">ref</strong><br/>
当通过普通的二级索引列与常量进行等值匹配时来查询某个表，那么对该表的 访问方法就可能是ref。</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">fulltext</strong><br/>
全文索引</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">ref_or_null</strong><br/>
当对普通二级索引进行等值匹配查询，该索引列的值也可以是NULL值时，那么对该表的访问方法就可能是ref_or_null，比如说：<img src="15-Explain详解_files/Image [16].png" type="image/png" data-filename="Image.png"/></p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">index_merge</strong><br/>
一般情况下对于某个表的查询只能使用到一个索引，但讲单表访问方法时特意强调了在某些场景下可以使用Intersection、Union、Sort-Union这三种<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">索引合并</strong>的方式来执行查询：<img src="15-Explain详解_files/Image [17].png" type="image/png" data-filename="Image.png"/></p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">unique_subquery</strong><br/>
类似于两表连接中被驱动表的eq_ref访问方法，unique_subquery是针对在一些包含IN子查询的查询语句中，如果查询优化器决定将IN子查询转换为EXISTS子查询，而且子查询可以使用到主键进行等值匹配的话，那么该子查询执行计划的type列的值就是unique_subquery，比如下边的这个查询语句：<img src="15-Explain详解_files/Image [18].png" type="image/png" data-filename="Image.png"/></p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">index_subquery</strong><br/>
index_subquery与unique_subquery类似，只不过访问子查询中的表时使用的是普通的索引，比如这样：<img src="15-Explain详解_files/Image [19].png" type="image/png" data-filename="Image.png"/></p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">range</strong><br/>
如果使用索引获取某些范围区间的记录，那么就可能使用到range访问方法，比如下边的这个查询：<img src="15-Explain详解_files/Image [20].png" type="image/png" data-filename="Image.png"/></p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">index</strong><br/>
使用索引覆盖，但需要扫描全部的索引记录时，该表的访问方法就是index，比如这样：<img src="15-Explain详解_files/Image [21].png" type="image/png" data-filename="Image.png"/></p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">ALL</strong><br/>
全表扫描<img src="15-Explain详解_files/Image [22].png" type="image/png" data-filename="Image.png"/></p>
</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">一般来说，这些访问方法按照我们介绍它们的顺序性能依次变差。其中除了All这个访问方法外，其余的访问方法都能用到索引，除了index_merge访问方法外，其余的访问方法都最多只能用到一个索引。</p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">possible_keys和key</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">在EXPLAIN语句输出的执行计划中，possible_keys列表示在某个查询语句中，对某个表执行单表查询时可能用到的索引有哪些，key列表示实际用到的索引有哪些，比方说下边这个查询：<img src="15-Explain详解_files/Image [23].png" type="image/png" data-filename="Image.png"/><br/>
上述执行计划的possible_keys列的值是idx_key1,idx_key3，表示该查询可能使用到idx_key1,idx_key3两个索引，然后key列的值是idx_key3，表示经过查询优化器计算使用不同索引的成本后，最后决定使用idx_key3来执行查询比较划算。</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">不过有一种情况比较特殊：</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">type为index（覆盖索引）的访问方式</strong><br/>
在使用index访问方法来查询某个表时，possible_keys列是空的，而key列展示的是实际使用到的索引，比如这样：<br/>
<img src="15-Explain详解_files/Image [24].png" type="image/png" data-filename="Image.png"/></li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">另外需要注意的一点是，<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">possible_keys列中的值并不是越多越好，可能使用的索引越多，查询优化器计算查询成本时就得花费更长时间，所以如果可以的话，尽量删除那些用不到的索引。</strong></p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">key_len</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">key_len列表示当优化器决定使用某个索引执行查询时，该索引记录的最大长度，它是由这三个部分构成的：</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">对于使用固定长度类型的索引列来说，它实际占用的存储空间的最大长度就是该固定值，对于指定字符集的变长类型的索引列来说，比如某个索引列的类型是VARCHAR(100)，使用的字符集是utf8，那么该列实际占用的最大存储空间就是100 × 3 = 300个字节；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">如果该索引列可以存储NULL值，则key_len比不可以存储NULL值时多1个字节；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">对于变长字段来说，都会有2个字节的空间来存储该变长列的实际长度。</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;"><img src="15-Explain详解_files/Image [25].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">由于id列的类型是INT，并且不可以存储NULL值，所以在使用该列的索引时key_len大小就是4。当索引列可以存储NULL值时，比如：<img src="15-Explain详解_files/Image [26].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">对于可变长度的索引列来说，比如下边这个查询：<img src="15-Explain详解_files/Image [27].png" type="image/png" data-filename="Image.png"/><br/>
由于key1列的类型是VARCHAR(100)，所以该列实际最多占用的存储空间就是300字节，又因为该列允许存储NULL值，所以key_len需要加1，又因为该列是可变长度列，所以key_len需要加2，所以最后ken_len的值就是303。</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">执行计划的生成是在MySQL server层中的功能，并不是针对具体某个存储引擎的功能，设计MySQL的大叔在执行计划中输出key_len列主要是为了让我们区分某个使用联合索引的查询具体用了几个索引列，而不是为了准确的说明针对某个具体存储引擎存储变长字段的实际长度占用的空间到底是占用1个字节还是2个字节。比方说下边这个使用到联合索引idx_key_part的查询：<img src="15-Explain详解_files/Image [28].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">这个查询的执行计划的ken_len列的值是606，说明执行这个查询的时候可以用到联合索引idx_key_part的两个索引列。</p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">ref</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">当使用索引列等值匹配的条件去执行查询时，也就是在访问方法是const、eq_ref、ref、ref_or_null、unique_subquery、index_subquery其中之一时，ref列展示的就是与索引列作等值匹配的东东是个啥，比如只是一个常数或者是某个列。大家看下边这个查询：<img src="15-Explain详解_files/Image [29].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">可以看到ref列的值是const，表明在使用idx_key1索引执行查询时，与key1列作等值匹配的对象是一个常数，当然有时候更复杂一点：<img src="15-Explain详解_files/Image [30].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">可以看到对被驱动表s2的访问方法是eq_ref，而对应的ref列的值是xiaohaizi.s1.id，这说明在对被驱动表进行访问时会用到PRIMARY索引，也就是聚簇索引与一个列进行等值匹配的条件，于s2表的id作等值匹配的对象就是xiaohaizi.s1.id列（注意这里把数据库名也写出来了）。<br/>
有的时候与索引列进行等值匹配的对象是一个函数，比方说下边这个查询：<br/>
<img src="15-Explain详解_files/Image [31].png" type="image/png" data-filename="Image.png"/><br/>
执行计划的第二条记录，可以看到对s2表采用ref访问方法执行查询，然后在查询计划的ref列里输出的是func，说明与s2表的key1列进行等值匹配的对象是一个函数。</p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">rows</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">如果查询优化器决定使用全表扫描的方式对某个表执行查询时，执行计划的rows列就代表预计需要扫描的行数，如果使用索引来执行查询时，执行计划的rows列就代表预计扫描的索引记录行数。比如下边这个查询：<img src="15-Explain详解_files/Image [32].png" type="image/png" data-filename="Image.png"/><br/>
到执行计划的rows列的值是266，这意味着查询优化器在经过分析使用idx_key1进行查询的成本之后，觉得满足key1 &gt; 'z'这个条件的记录只有266条。</p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">filtered</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">之前在分析连接查询的成本时提出过一个condition filtering的概念，就是MySQL在计算驱动表扇出时采用的一个策略：</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">如果使用的是全表扫描的方式执行的单表查询，那么计算驱动表扇出时需要估计出满足搜索条件的记录到底有多少条；</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">如果使用的是索引执行的单表扫描，那么计算驱动表扇出的时候需要估计出满足除使用到对应索引的搜索条件外的其他搜索条件的记录有多少条。</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;"><img src="15-Explain详解_files/Image [33].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">从执行计划的key列中可以看出来，该查询使用idx_key1索引来执行查询，从rows列可以看出满足key1 &gt; 'z'的记录有266条。执行计划的filtered列就代表查询优化器预测在这266条记录中，有多少条记录满足其余的搜索条件，也就是common_field = 'a'这个条件的百分比。此处filtered列的值是10.00，说明查询优化器预测在266条记录中有10.00%的记录满足common_field = 'a'这个条件。<br/>
对于单表查询来说，这个filtered列的值没什么意义，我们更关注在连接查询中驱动表对应的执行计划记录的filtered值，比方说下边这个查询：<img src="15-Explain详解_files/Image [34].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">从执行计划中可以看出来，查询优化器打算把s1当作驱动表，s2当作被驱动表。我们可以看到驱动表s1表的执行计划的rows列为9688， filtered列为10.00，这意味着驱动表s1的扇出值就是9688 × 10.00% = 968.8，这说明还要对被驱动表执行大约968次查询。</p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">Extra</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">Extra列用来说明一些额外信息，通过这些额外西悉尼来更准确的理解MySQL列将如何执行给定的查询语句，这里挑一些平时常见的或者比较重要的。</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">No tables used</strong><br/>
当查询语句的没有FROM子句时将会提示该额外信息，比如：<br/>
EXPLAIN SELECT 1；<img src="15-Explain详解_files/Image [35].png" type="image/png" data-filename="Image.png"/></p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Impossible WHERE</strong><br/>
查询语句的WHERE子句永远为FALSE时将会提示该额外信息，比方说：<br/>
EXPLAIN SELECT * FROM s1 WHERE 1 != 1；</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">No matching min/max row</strong><br/>
当查询列表处有MIN或者MAX聚集函数，但是并没有符合WHERE子句中的搜索条件的记录时，将会提示该额外信息，比方说：<br/>
XPLAIN SELECT MIN(key1) FROM s1 WHERE key1 = 'abcdefg'；<img src="15-Explain详解_files/Image [36].png" type="image/png" data-filename="Image.png"/></p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Using index</strong><br/>
当我们的查询列表以及搜索条件中只包含属于某个索引的列，也就是在可以使用索引覆盖的情况下，在Extra列将会提示该额外信息。比方说下边这个查询中只需要用到idx_key1而不需要回表操作：</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Using index condition</strong><br/>
有些搜索条件中虽然出现了索引列，但却不能使用到索引，比如下边这个查询：<br/>
SELECT * FROM s1 WHERE key1 &gt; 'z' AND key1 LIKE '%a'；<br/>
其中的key1 &gt; 'z'可以使用到索引，但是key1 LIKE '%a'却无法使用到索引；<br/>
a. 先根据key1 &gt; 'z'这个条件，定位到二级索引idx_key1中对应的二级索引记录；<br/>
b. 对于指定的二级索引记录，先不着急回表，而是先检测一下该记录是否满足key1 LIKE '%a'这个条件，如果这个条件不满足，则该二级索引记录压根儿就没必要回表；<br/>
c. 对于满足key1 LIKE '%a'这个条件的二级索引记录执行回表操作.<br/>
我们说回表操作其实是一个随机IO，比较耗时，所以上述修改虽然只改进了一点点，但是可以省去好多回表操作的成本。设计MySQL的大叔们把他们的这个改进称之为<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">索引条件下推（英文名：Index Condition Pushdown）</strong>。<br/>
<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">如果在查询语句的执行过程中将要使用索引条件下推这个特性，在Extra列中将会显示Using index condition</strong>，比如这样：<img src="15-Explain详解_files/Image [37].png" type="image/png" data-filename="Image.png"/></p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Using where</strong><br/>
当我们使用全表扫描来执行对某个表的查询，并且该语句的WHERE子句中有针对该表的搜索条件时，在Extra列中会提示上述额外信息。比如下边这个查询：<br/>
EXPLAIN SELECT * FROM s1 WHERE common_field = 'a'；<img src="15-Explain详解_files/Image [38].png" type="image/png" data-filename="Image.png"/><br/>
当使用索引访问来执行对某个表的查询，并且该语句的WHERE子句中有除了该索引包含的列之外的其他搜索条件时，在Extra列中也会提示上述额外信息。比如下边这个查询虽然使用idx_key1索引执行查询，但是搜索条件中除了包含key1的搜索条件key1 = 'a'，还有包含common_field的搜索条件，所以Extra列会显示Using where的提示：<br/>
EXPLAIN SELECT * FROM s1 WHERE key1 = 'a' AND common_field = 'a';</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Using join buffer (Block Nested Loop)</strong><br/>
在连接查询执行过程中，当被驱动表不能有效的利用索引加快访问速度，MySQL一般会为其分配一块名叫join buffer的内存块来加快查询速度，也就是我们所讲的基于块的嵌套循环算法，比如下边这个查询语句：<br/>
EXPLAIN SELECT * FROM s1 INNER JOIN s2 ON s1.common_field = s2.common_field；<img src="15-Explain详解_files/Image [39].png" type="image/png" data-filename="Image.png"/><br/>
可以在对s2表的执行计划的Extra列显示了两个提示：<br/>
a. **Using join buffer (Block Nested Loop)：**这是因为对表s2的访问不能有效利用索引，只好退而求其次，使用join buffer来减少对s2表的访问次数，从而提高性能；<br/>
b. **Using where：**可以看到查询语句中有一个s1.common_field = s2.common_field条件，因为s1是驱动表，s2是被驱动表，所以在访问s2表时，s1.common_field的值已经确定下来了，所以实际上查询s2表的条件就是s2.common_field = 一个常数，所以提示了Using where额外信息.</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Not exists</strong><br/>
当我们使用左（外）连接时，如果WHERE子句中包含要求被驱动表的某个列等于NULL值的搜索条件，而且那个列又是不允许存储NULL值的，那么在该表的执行计划的Extra列就会提示Not exists额外信息，比如这样：<img src="15-Explain详解_files/Image [40].png" type="image/png" data-filename="Image.png"/><br/>
上述查询中s1表是驱动表，s2表是被驱动表，s2.id列是不允许存储NULL值的，而WHERE子句中又包含s2.id IS NULL的搜索条件，这意味着必定是驱动表的记录在被驱动表中找不到匹配ON子句条件的记录才会把该驱动表的记录加入到最终的结果集，所以对于某条驱动表中的记录来说，如果能在被驱动表中找到1条符合ON子句条件的记录，那么该驱动表的记录就不会被加入到最终的结果集，也就是说我们<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">没有必要到被驱动表中找到全部符合ON子句条件的记录</strong>，这样可以稍微节省一点性能。</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Using intersect(...)、Using union(...)和Using sort_union(...)</strong><br/>
如果执行计划的Extra列出现了Using intersect(...)提示，说明准备使用Intersect索引合并的方式执行查询，括号中的...表示需要进行索引合并的索引名称；如果出现了Using union(...)提示，说明准备使用Union索引合并的方式执行查询；出现了Using sort_union(...)提示，说明准备使用Sort-Union索引合并的方式执行查询。比如这个查询的执行计划：<br/>
EXPLAIN SELECT * FROM s1 WHERE key1 = 'a' AND key3 = 'a'；<img src="15-Explain详解_files/Image [41].png" type="image/png" data-filename="Image.png"/><br/>
其中Extra列就显示了Using intersect(idx_key3,idx_key1)，表明MySQL即将使用idx_key3和idx_key1这两个索引进行Intersect索引合并的方式执行查询。</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Zero limit</strong><br/>
当我们的LIMIT子句的参数为0时，表示压根儿不打算从表中读出任何记录，将会提示该额外信息，比如这样：<br/>
EXPLAIN SELECT * FROM s1 LIMIT 0；</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Using filesort</strong><br/>
很多情况下排序操作无法使用到索引，只能在内存中（记录较少的时候）或者磁盘中（记录较多的时候）进行排序，MySQL把这种在内存中或者磁盘上进行排序的方式统称为<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">文件排序（英文名：filesort）</strong>。如果某个查询需要使用文件排序的方式执行查询，就会在执行计划的Extra列中显示Using filesort提示，比如这样：EXPLAIN SELECT * FROM s1 ORDER BY common_field LIMIT 10；<br/>
需要注意的是，如果查询中需要使用filesort的方式进行排序的记录非常多，那么这个过程是很耗费性能的，最好想办法将使用文件排序的执行方式改为使用索引进行排序。</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Using temporary</strong><br/>
在许多查询的执行过程中，MySQL可能会借助临时表来完成一些功能，比如去重、排序之类的，比如我们在执行许多包含DISTINCT、GROUP BY、UNION等子句的查询过程中，如果不能有效利用索引来完成查询，MySQL很有可能寻求通过建立内部的临时表来执行查询。如果查询中使用到了内部的临时表，在执行计划的Extra列将会显示Using temporary提示，比方说这样：<br/>
EXPLAIN SELECT DISTINCT common_field FROM s1；<img src="15-Explain详解_files/Image [42].png" type="image/png" data-filename="Image.png"/><br/>
上述执行计划的Extra列不仅仅包含Using temporary提示，还包含Using filesort提示，可是我们的查询语句中明明没有写ORDER BY子句呀？这是因为<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">MySQL会在包含GROUP BY子句的查询中默认添加上ORDER BY子句</strong>，也就是说上述查询其实和下边这个查询等价：<br/>
EXPLAIN SELECT common_field, COUNT(<em style="line-height: 160%; box-sizing: content-box; font-style: italic;">) AS amount FROM s1 GROUP BY common_field ORDER BY common_field；<br/>
如果我们并不想为包含GROUP BY子句的查询进行排序，需要我们显式的写上ORDER BY NULL，就像这样：<br/>
EXPLAIN SELECT common_field, COUNT(</em>) AS amount FROM s1 GROUP BY common_field ORDER BY NULL；<br/>
另外，执行计划中出现Using temporary并不是一个好的征兆，因为建立与维护临时表要付出很大成本的，所以我们最好能使用索引来替代掉使用临时表，比方说下边这个包含GROUP BY子句的查询就不需要使用临时表：<br/>
EXPLAIN SELECT key1, COUNT(*) AS amount FROM s1 GROUP BY key1；</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">Start temporary, End temporary</strong><br/>
查询优化器会优先尝试将IN子查询转换成semi-join，而semi-join又有好多种执行策略，当执行策略为<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">DuplicateWeedout</strong>时，也就是通过建立临时表来实现为外层查询中的记录进行去重操作时，驱动表查询执行计划的Extra列将显示Start temporary提示，被驱动表查询执行计划的Extra列将显示End temporary提示，就是这样：<br/>
<img src="15-Explain详解_files/Image [43].png" type="image/png" data-filename="Image.png"/><br/>
<img src="15-Explain详解_files/Image [44].png" type="image/png" data-filename="Image.png"/></p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">LooseScan</strong><br/>
在将In子查询转为semi-join时，如果采用的是LooseScan执行策略，则在驱动表执行计划的Extra列就是显示LooseScan提示，比如这样：<br/>
EXPLAIN SELECT * FROM s1 WHERE key3 IN (SELECT key1 FROM s2 WHERE key1 &gt; 'z')；</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">FirstMatch(tbl_name)</strong><br/>
在将In子查询转为semi-join时，如果采用的是FirstMatch执行策略，则在被驱动表执行计划的Extra列就是显示FirstMatch(tbl_name)提示，比如这样：<br/>
EXPLAIN SELECT * FROM s1 WHERE common_field IN (SELECT key1 FROM s2 where s1.key3 = s2.key3)；<br/>
<img src="15-Explain详解_files/Image [45].png" type="image/png" data-filename="Image.png"/></p>
</li>
</ul>
<h2 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 34px; border-bottom: 1px solid #dbdbdb; color: #333;">Json格式的执行计划</h2>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">我们上边介绍的EXPLAIN语句输出中缺少了一个衡量执行计划好坏的重要属性 —— 成本。不过设计MySQL的大叔贴心的为我们提供了一种查看某个执行计划花费的成本的方式：</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">在EXPLAIN单词和真正的查询语句中间加上<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">FORMAT=JSON</strong></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">mysql&gt; EXPLAIN FORMAT=JSON SELECT * FROM s1 INNER JOIN s2 ON s1.key1 = s2.key2 WHERE s1.common_field = 'a'\G。</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">先看s1表的&quot;cost_info&quot;部分：<br/>
&quot;cost_info&quot;: { &quot;read_cost&quot;: &quot;1840.84&quot;, &quot;eval_cost&quot;: &quot;193.76&quot;, &quot;prefix_cost&quot;: &quot;2034.60&quot;, &quot;data_read_per_join&quot;: &quot;1M&quot; }</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;">read_cost是由下边这两部分组成的：<br/>
a. IO成本<br/>
b. 检测rows × (1 - filter)条记录的CPU成本</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;">eval_cost是这样计算的：<br/>
检测 rows × filter条记录的成本</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;">prefix_cost就是单独查询s1表的成本，也就是：<br/>
read_cost + eval_cost</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;">data_read_per_join表示在此次查询中需要读取的数据量</p>
</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;"><img src="15-Explain详解_files/Image [46].png" type="image/png" data-filename="Image.png"/></p>
<h2 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 34px; border-bottom: 1px solid #dbdbdb; color: #333;">Extented EXPLAIN</h2>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">使用EXPLAIN语句查看了某个查询的执行计划后，紧接着还可以使用<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">SHOW WARNINGS语句</strong>查看与这个查询的执行计划有关的一些扩展信息，比如这样：<img src="15-Explain详解_files/Image [47].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">Message: /* select#1 */ select <code style="line-height: 160%; box-sizing: content-box; border: 0; border-radius: 0; color: #c1788b; padding: 4px 4px 2px 0; letter-spacing: -.3px;">xiaohaizi</code>.<code style="line-height: 160%; box-sizing: content-box; border: 0; border-radius: 0; color: #c1788b; padding: 4px 4px 2px 0; letter-spacing: -.3px;">s1</code>.<code style="line-height: 160%; box-sizing: content-box; border: 0; border-radius: 0; color: #c1788b; padding: 4px 4px 2px 0; letter-spacing: -.3px;">key1</code> AS <code style="line-height: 160%; box-sizing: content-box; border: 0; border-radius: 0; color: #c1788b; padding: 4px 4px 2px 0; letter-spacing: -.3px;">key1</code>,<code style="line-height: 160%; box-sizing: content-box; border: 0; border-radius: 0; color: #c1788b; padding: 4px 4px 2px 0; letter-spacing: -.3px;">xiaohaizi</code>.<code style="line-height: 160%; box-sizing: content-box; border: 0; border-radius: 0; color: #c1788b; padding: 4px 4px 2px 0; letter-spacing: -.3px;">s2</code>.<code style="line-height: 160%; box-sizing: content-box; border: 0; border-radius: 0; color: #c1788b; padding: 4px 4px 2px 0; letter-spacing: -.3px;">key1</code> AS <code style="line-height: 160%; box-sizing: content-box; border: 0; border-radius: 0; color: #c1788b; padding: 4px 4px 2px 0; letter-spacing: -.3px;">key1</code> from <code style="line-height: 160%; box-sizing: content-box; border: 0; border-radius: 0; color: #c1788b; padding: 4px 4px 2px 0; letter-spacing: -.3px;">xiaohaizi</code>.<code style="line-height: 160%; box-sizing: content-box; border: 0; border-radius: 0; color: #c1788b; padding: 4px 4px 2px 0; letter-spacing: -.3px;">s1</code> join <code style="line-height: 160%; box-sizing: content-box; border: 0; border-radius: 0; color: #c1788b; padding: 4px 4px 2px 0; letter-spacing: -.3px;">xiaohaizi</code>.<code style="line-height: 160%; box-sizing: content-box; border: 0; border-radius: 0; color: #c1788b; padding: 4px 4px 2px 0; letter-spacing: -.3px;">s2</code> where ((<code style="line-height: 160%; box-sizing: content-box; border: 0; border-radius: 0; color: #c1788b; padding: 4px 4px 2px 0; letter-spacing: -.3px;">xiaohaizi</code>.<code style="line-height: 160%; box-sizing: content-box; border: 0; border-radius: 0; color: #c1788b; padding: 4px 4px 2px 0; letter-spacing: -.3px;">s1</code>.<code style="line-height: 160%; box-sizing: content-box; border: 0; border-radius: 0; color: #c1788b; padding: 4px 4px 2px 0; letter-spacing: -.3px;">key1</code> = <code style="line-height: 160%; box-sizing: content-box; border: 0; border-radius: 0; color: #c1788b; padding: 4px 4px 2px 0; letter-spacing: -.3px;">xiaohaizi</code>.<code style="line-height: 160%; box-sizing: content-box; border: 0; border-radius: 0; color: #c1788b; padding: 4px 4px 2px 0; letter-spacing: -.3px;">s2</code>.<code style="line-height: 160%; box-sizing: content-box; border: 0; border-radius: 0; color: #c1788b; padding: 4px 4px 2px 0; letter-spacing: -.3px;">key1</code>) and (<code style="line-height: 160%; box-sizing: content-box; border: 0; border-radius: 0; color: #c1788b; padding: 4px 4px 2px 0; letter-spacing: -.3px;">xiaohaizi</code>.<code style="line-height: 160%; box-sizing: content-box; border: 0; border-radius: 0; color: #c1788b; padding: 4px 4px 2px 0; letter-spacing: -.3px;">s2</code>.<code style="line-height: 160%; box-sizing: content-box; border: 0; border-radius: 0; color: #c1788b; padding: 4px 4px 2px 0; letter-spacing: -.3px;">common_field</code> is not null))</p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">大家可以看到SHOW WARNINGS展示出来的信息有三个字段，分别是Level、Code、Message。我们最常见的就是Code为1003的信息，当Code值为1003时，Message字段展示的信息类似于查询优化器将我们的查询语句重写后的语句。比如我们上边的查询本来是一个左（外）连接查询，但是有一个s2.common_field IS NOT NULL的条件，着就会导致查询优化器把左（外）连接查询优化为内连接查询，从SHOW WARNINGS的Message字段也可以看出来，原本的LEFT JOIN已经变成了JOIN。<br/>
但是大家一定要注意，我们说Message字段展示的信息类似于查询优化器将我们的查询语句重写后的语句，并不是等价于，也就是说Message字段展示的信息并不是标准的查询语句，在很多情况下并不能直接拿到黑框框中运行，它只能作为帮助我们理解查MySQL将如何执行查询语句的一个参考依据而已。</p>
</div><center style="display:none !important;visibility:collapse !important;height:0 !important;white-space:nowrap;width:100%;overflow:hidden">%E4%B8%80%E6%9D%A1%E6%9F%A5%E8%AF%A2%E8%AF%AD%E5%8F%A5%E5%9C%A8%E7%BB%8F%E8%BF%87MySQL%E6%9F%A5%E8%AF%A2%E4%BC%98%E5%8C%96%E5%99%A8%E7%9A%84%E5%90%84%E7%A7%8D%E5%9F%BA%E4%BA%8E%E6%88%90%E6%9C%AC%E5%92%8C%E8%A7%84%E5%88%99%E7%9A%84%E4%BC%98%E5%8C%96%E4%BC%9A%E5%90%8E%E7%94%9F%E6%88%90%E4%B8%80%E4%B8%AA%E6%89%80%E8%B0%93%E7%9A%84**%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92**%EF%BC%8C%E9%80%9A%E8%BF%87EXPLAIN%E8%AF%AD%E5%8F%A5%E5%8F%AF%E4%BB%A5%E6%9F%A5%E7%9C%8B%E5%85%B7%E4%BD%93%E7%9A%84%E6%89%A7%E6%AF%94%E8%BE%83%E4%B8%80%E6%9D%A1%E6%9F%A5%E8%AF%A2%E8%AF%AD%E5%8F%A5%E5%9C%A8%E7%BB%8F%E8%BF%87MySQL%E6%9F%A5%E8%AF%A2%E4%BC%98%E5%8C%96%E5%99%A8%E7%9A%84%E5%90%84%E7%A7%8D%E5%9F%BA%E4%BA%8E%E6%88%90%E6%9C%AC%E5%92%8C%E8%A7%84%E5%88%99%E7%9A%84%E4%BC%98%E5%8C%96%E4%BC%9A%E5%90%8E%E7%94%9F%E6%88%90%E4%B8%80%E4%B8%AA%E6%89%80%E8%B0%93%E7%9A%84**%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92**%EF%BC%8C%E9%80%9A%E8%BF%87EXPLAIN%E8%AF%AD%E5%8F%A5%E5%8F%AF%E4%BB%A5%E6%9F%A5%E7%9C%8B%E5%85%B7%E4%BD%93%E7%9A%84%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E3%80%82%0A%0A%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E9%87%8C%E7%9A%84%E8%BE%93%E5%87%BA%E9%A1%B9%E5%A4%A7%E8%87%B4%E5%A6%82%E4%B8%8B%EF%BC%9A%0A!%5B92019b0e5cbe4d03801960c4b17a2159.png%5D(en-resource%3A%2F%2Fdatabase%2F851%3A1)%0A%0A%0A!%5B6b5586a6029296909a6f42e2575c2316.png%5D(en-resource%3A%2F%2Fdatabase%2F850%3A1)%0A%E5%81%87%E8%AE%BE%E6%9C%892%E4%B8%AA%E5%92%8Csingle_table%E8%A1%A8%E7%BB%93%E6%9E%84%E4%B8%80%E6%A0%B7%E7%9A%84s1%E3%80%81s2%E8%A1%A8%EF%BC%8C%E8%80%8C%E4%B8%94%E8%BF%99%E4%B8%A4%E5%BC%A0%E8%A1%A8%E9%87%8C%E6%9C%8910000%E6%9D%A1%E8%AE%B0%E5%BD%95%EF%BC%8C%E9%99%A4id%E5%88%97%E5%A4%96%E5%85%B6%E4%BB%96%E7%9A%84%E5%88%97%E9%83%BD%E6%8F%92%E5%85%A5%E9%9A%8F%E6%9C%BA%E5%80%BC%E3%80%82%0A%0A%23%23%20%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E8%BE%93%E5%87%BA%E4%B8%AD%E5%90%84%E5%88%97%E8%AF%A6%E8%A7%A3%0A%0A%23%23%23%20table%0A%E6%97%A0%E8%AE%BA%E6%9F%A5%E8%AF%A2%E8%AF%AD%E5%8F%A5%E6%9C%89%E5%A4%9A%E5%A4%8D%E6%9D%82%EF%BC%8C%E5%8C%85%E5%90%AB%E5%A4%9A%E5%B0%91%E5%BC%A0%E8%A1%A8%EF%BC%8C%E6%9C%80%E5%90%8E%E4%B9%9F%E6%98%AF%E9%9C%80%E8%A6%81%E5%AF%B9%E6%AF%8F%E4%B8%AA%E8%A1%A8%E8%BF%9B%E8%A1%8C%E5%8D%95%E8%A1%A8%E8%AE%BF%E9%97%AE%E7%9A%84%EF%BC%8C%E6%89%80%E4%BB%A5MySQL%E8%A7%84%E5%AE%9A%EF%BC%8CEXPLAIN%E8%AF%AD%E5%8F%A5%E8%BE%93%E5%87%BA%E7%9A%84%E6%AF%8F%E6%9D%A1%E8%AE%B0%E5%BD%95%E9%83%BD%E5%AF%B9%E5%BA%94%E7%9D%80%E6%9F%90%E4%B8%AA%E5%8D%95%E8%A1%A8%E7%9A%84%E8%AE%BF%E9%97%AE%E6%96%B9%E6%B3%95%EF%BC%8C%E8%AF%A5%E6%9D%A1%E8%AE%B0%E5%BD%95%E7%9A%84table%E5%88%97%E4%BB%A3%E8%A1%A8%E7%9D%80%E8%AF%A5%E8%A1%A8%E7%9A%84%E8%A1%A8%E5%90%8D%E3%80%82!%5B62d607f07a878179590deb7cb7b839fd.png%5D(en-resource%3A%2F%2Fdatabase%2F852%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E5%AF%B9%E5%BA%94%E4%B8%80%E4%B8%AA%E5%94%AF%E4%B8%80%E7%9A%84id%E5%80%BC**%EF%BC%8C%E6%AF%94%E5%A6%82%E8%BF%99%E6%A0%B7%EF%BC%9A!%5B2220cbcc327ab2794ac0c62ccab9f9db.png%5D(en-resource%3A%2F%2Fdatabase%2F854%3A1)%0A%E4%BD%86%E6%98%AF%E8%BF%99%E9%87%8C%E9%9C%80%E8%A6%81%E7%89%B9%E5%88%AB%E6%B3%A8%E6%84%8F%EF%BC%8C**%E6%9F%A5%E8%AF%A2%E4%BC%98%E5%8C%96%E5%99%A8%E5%8F%AF%E8%83%BD%E5%AF%B9%E6%B6%89%E5%8F%8A%E5%AD%90%E6%9F%A5%E8%AF%A2%E7%9A%84%E6%9F%A5%E8%AF%A2%E8%AF%AD%E5%8F%A5%E8%BF%9B%E8%A1%8C%E9%87%8D%E5%86%99%EF%BC%8C%E4%BB%8E%E8%80%8C%E8%BD%AC%E6%8D%A2%E4%B8%BA%E8%BF%9E%E6%8E%A5%E6%9F%A5%E8%AF%A2**%E3%80%82%E6%89%80%E4%BB%A5%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E6%83%B3%E7%9F%A5%E9%81%93%E6%9F%A5%E8%AF%A2%E4%BC%98%E5%8C%96%E5%99%A8%E5%AF%B9%E6%9F%90%E4%B8%AA%E5%8C%85%E5%90%AB%E5%AD%90%E6%9F%A5%E8%AF%A2%E7%9A%84%E8%AF%AD%E5%8F%A5%E6%98%AF%E5%90%A6%E8%BF%9B%E8%A1%8C%E4%BA%86%E9%87%8D%E5%86%99%EF%BC%8C%E7%9B%B4%E6%8E%A5%E6%9F%A5%E7%9C%8B%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E5%B0%B1%E5%A5%BD%E4%BA%86%EF%BC%8C%E6%AF%94%E5%A6%82%E8%AF%B4%EF%BC%9A!%5B3b5dc1a1d6229451439a97555ca71f9a.png%5D(en-resource%3A%2F%2Fdatabase%2F855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90%ABUNION%20ALL%E5%AD%90%E5%8F%A5%E7%9A%84%E6%9F%A5%E8%AF%A2%E7%9A%84%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E4%B8%AD%EF%BC%8C%E5%B0%B1%E6%B2%A1%E6%9C%89%E9%82%A3%E4%B8%AAid%E4%B8%BANULL%E7%9A%84%E8%AE%B0%E5%BD%95%E3%80%82%0A%0A%23%23%23%20select_type%0A%E9%80%9A%E8%BF%87select_type%E5%8F%AF%E4%BB%A5%E7%9F%A5%E9%81%93%E5%B0%8F%E6%9F%A5%E8%AF%A2%E5%9C%A8%E6%95%B4%E4%B8%AA%E5%A4%A7%E6%9F%A5%E8%AF%A2%E4%B8%AD%E6%89%AE%E6%BC%94%E4%BA%86%E4%B8%80%E4%B8%AA%E4%BB%80%E4%B9%88%E6%A0%B7%E7%9A%84%E8%A7%92%E8%89%B2%EF%BC%9A%0A!%5Bc4c0b53ef1a248853192b8479893074c.png%5D(en-resource%3A%2F%2Fdatabase%2F856%3A1)%0A%0A*%20**SIMPLE**%0A%E6%9F%A5%E8%AF%A2%E8%AF%AD%E5%8F%A5%E4%B8%AD**%E4%B8%8D%E5%8C%85%E5%90%AB**UNION%E6%88%96%E8%80%85%E5%AD%90%E6%9F%A5%E8%AF%A2%E7%9A%84%E6%9F%A5%E8%AF%A2%E9%83%BD%E7%AE%97%E6%98%AF**SIMPLE**%E7%B1%BB%E5%9E%8B%E3%80%82%E5%BD%93%E7%84%B6%EF%BC%8C%E8%BF%9E%E6%8E%A5%E6%9F%A5%E8%AF%A2%E4%B9%9F%E7%AE%97%E6%98%AFSIMPLE%E7%B1%BB%E5%9E%8B%E3%80%82%0A%0A*%20**PRIMARY**%0A%E5%AF%B9%E4%BA%8E%E5%8C%85%E5%90%ABUNION%E3%80%81UNION%20ALL%E6%88%96%E8%80%85%E5%AD%90%E6%9F%A5%E8%AF%A2%E7%9A%84%E5%A4%A7%E6%9F%A5%E8%AF%A2%E6%9D%A5%E8%AF%B4%EF%BC%8C%E5%AE%83%E6%98%AF%E7%94%B1%E5%87%A0%E4%B8%AA%E5%B0%8F%E6%9F%A5%E8%AF%A2%E7%BB%84%E6%88%90%E7%9A%84%EF%BC%8C%E5%85%B6%E4%B8%AD%E6%9C%80%E5%B7%A6%E8%BE%B9%E7%9A%84%E9%82%A3%E4%B8%AA%E6%9F%A5%E8%AF%A2%E7%9A%84select_type%E5%80%BC%E5%B0%B1%E6%98%AFPRIMARY%E3%80%82%0A%0A*%20**UNION**%0A%E5%AF%B9%E4%BA%8E%E5%8C%85%E5%90%ABUNION%E6%88%96%E8%80%85UNION%20ALL%E7%9A%84%E5%A4%A7%E6%9F%A5%E8%AF%A2%E6%9D%A5%E8%AF%B4%EF%BC%8C%E5%AE%83%E6%98%AF%E7%94%B1%E5%87%A0%E4%B8%AA%E5%B0%8F%E6%9F%A5%E8%AF%A2%0A%0A*%20**UNION%20RESULT**%0AMySQL%E9%80%89%E6%8B%A9%E4%BD%BF%E7%94%A8%E4%B8%B4%E6%97%B6%E8%A1%A8%E6%9D%A5%E5%AE%8C%E6%88%90UNION%E6%9F%A5%E8%AF%A2%E7%9A%84%E5%8E%BB%E9%87%8D%E5%B7%A5%E4%BD%9C%EF%BC%8C%E9%92%88%E5%AF%B9%E8%AF%A5%E4%B8%B4%E6%97%B6%E8%A1%A8%E7%9A%84%E6%9F%A5%E8%AF%A2%E7%9A%84select_type%E5%B0%B1%E6%98%AFUNION%20RESULT%E3%80%82%0A%0A*%20**SUBQUERY**%0A%E5%A6%82%E6%9E%9C**%E5%8C%85%E5%90%AB%E5%AD%90%E6%9F%A5%E8%AF%A2%E7%9A%84%E6%9F%A5%E8%AF%A2%E8%AF%AD%E5%8F%A5%E4%B8%8D%E8%83%BD%E5%A4%9F%E8%BD%AC%E4%B8%BA%E5%AF%B9%E5%BA%94%E7%9A%84semi-join%E7%9A%84%E5%BD%A2%E5%BC%8F%EF%BC%8C%E5%B9%B6%E4%B8%94%E8%AF%A5%E5%AD%90%E6%9F%A5%E8%AF%A2%E6%98%AF%E4%B8%8D%E7%9B%B8%E5%85%B3%E5%AD%90%E6%9F%A5%E8%AF%A2%EF%BC%8C%E5%B9%B6%E4%B8%94%E6%9F%A5%E8%AF%A2%E4%BC%98%E5%8C%96%E5%99%A8%E5%86%B3%E5%AE%9A%E9%87%87%E7%94%A8%E5%B0%86%E8%AF%A5%E5%AD%90%E6%9F%A5%E8%AF%A2%E7%89%A9%E5%8C%96%E7%9A%84%E6%96%B9%E6%A1%88%E6%9D%A5%E6%89%A7%E8%A1%8C%E8%AF%A5%E5%AD%90%E6%9F%A5%E8%AF%A2**%E6%97%B6%EF%BC%8C%E8%AF%A5%E5%AD%90%E6%9F%A5%E8%AF%A2%E7%9A%84%E7%AC%AC%E4%B8%80%E4%B8%AASELECT%E5%85%B3%E9%94%AE%E5%AD%97%E4%BB%A3%E8%A1%A8%E7%9A%84%E9%82%A3%E4%B8%AA%E6%9F%A5%E8%AF%A2%E7%9A%84select_type%E5%B0%B1%E6%98%AF**SUBQUERY**%EF%BC%8C%E6%AF%94%E5%A6%82%E4%B8%8B%E8%BE%B9%E8%BF%99%E4%B8%AA%E6%9F%A5%E8%AF%A2%EF%BC%9A!%5Bb027434f59b4d9538c59adccfa992894.png%5D(en-resource%3A%2F%2Fdatabase%2F859%3A1)%0A%E5%8F%AF%E4%BB%A5%E7%9C%8B%E5%88%B0%EF%BC%8C%E5%A4%96%E5%B1%82%E6%9F%A5%E8%AF%A2%E7%9A%84select_type%E5%B0%B1%E6%98%AFPRIMARY%EF%BC%8C%E5%AD%90%E6%9F%A5%E8%AF%A2%E7%9A%84select_type%E5%B0%B1%E6%98%AFSUBQUERY%E3%80%82%E9%9C%80%E8%A6%81%E6%B3%A8%E6%84%8F%E7%9A%84%E6%98%AF%EF%BC%8C**%E7%94%B1%E4%BA%8Eselect_type%E4%B8%BASUBQUERY%E7%9A%84%E5%AD%90%E6%9F%A5%E8%AF%A2%E7%94%B1%E4%BA%8E%E4%BC%9A%E8%A2%AB%E7%89%A9%E5%8C%96%EF%BC%8C%E6%89%80%E4%BB%A5%E5%8F%AA%E9%9C%80%E8%A6%81%E6%89%A7%E8%A1%8C%E4%B8%80%E9%81%8D**%E3%80%82%0A%0A*%20**DEPENDENT%20SUBQUERY**%0A%E5%A6%82%E6%9E%9C**%E5%8C%85%E5%90%AB%E5%AD%90%E6%9F%A5%E8%AF%A2%E7%9A%84%E6%9F%A5%E8%AF%A2%E8%AF%AD%E5%8F%A5%E4%B8%8D%E8%83%BD%E5%A4%9F%E8%BD%AC%E4%B8%BA%E5%AF%B9%E5%BA%94%E7%9A%84semi-join%E7%9A%84%E5%BD%A2%E5%BC%8F%EF%BC%8C%E5%B9%B6%E4%B8%94%E8%AF%A5%E5%AD%90%E6%9F%A5%E8%AF%A2%E6%98%AF%E7%9B%B8%E5%85%B3%E5%AD%90%E6%9F%A5%E8%AF%A2**%EF%BC%8C%E5%88%99%E8%AF%A5%E5%AD%90%E6%9F%A5%E8%AF%A2%E7%9A%84%E7%AC%AC%E4%B8%80%E4%B8%AASELECT%E5%85%B3%E9%94%AE%E5%AD%97%E4%BB%A3%E8%A1%A8%E7%9A%84%E9%82%A3%E4%B8%AA%E6%9F%A5%E8%AF%A2%E7%9A%84select_type%E5%B0%B1%E6%98%AF**DEPENDENT%20SUBQUERY**%EF%BC%8C%E6%AF%94%E5%A6%82%E4%B8%8B%E8%BE%B9%E8%BF%99%E4%B8%AA%E6%9F%A5%E8%AF%A2%EF%BC%9A!%5B330cc7b9c5b43c28223483855a3f2e99.png%5D(en-resource%3A%2F%2Fdatabase%2F858%3A1)%0A%E9%9C%80%E8%A6%81%E6%B3%A8%E6%84%8F%E7%9A%84%E6%98%AF%EF%BC%8C**select_type%E4%B8%BADEPENDENT%20SUBQUERY%E7%9A%84%E6%9F%A5%E8%AF%A2%E5%8F%AF%E8%83%BD%E4%BC%9A%E8%A2%AB%E6%89%A7%E8%A1%8C%E5%A4%9A%E6%AC%A1%E3%80%82**%0A%0A*%20**DEPENDENT%20UNION**%0A%E5%9C%A8**%E5%8C%85%E5%90%ABUNION%E6%88%96%E8%80%85UNION%20ALL%E7%9A%84%E5%A4%A7%E6%9F%A5%E8%AF%A2%E4%B8%AD%EF%BC%8C%E5%A6%82%E6%9E%9C%E5%90%84%E4%B8%AA%E5%B0%8F%E6%9F%A5%E8%AF%A2%E9%83%BD%E4%BE%9D%E8%B5%96%E4%BA%8E%E5%A4%96%E5%B1%82%E6%9F%A5%E8%AF%A2%E7%9A%84%E8%AF%9D%EF%BC%8C%E9%82%A3%E9%99%A4%E4%BA%86%E6%9C%80%E5%B7%A6%E8%BE%B9%E7%9A%84%E9%82%A3%E4%B8%AA%E5%B0%8F%E6%9F%A5%E8%AF%A2%E4%B9%8B%E5%A4%96%EF%BC%8C%E5%85%B6%E4%BD%99%E7%9A%84%E5%B0%8F%E6%9F%A5%E8%AF%A2%E7%9A%84select_type%E7%9A%84%E5%80%BC%E5%B0%B1%E6%98%AFDEPENDENT%20UNION**%E3%80%82%E8%AF%B4%E7%9A%84%E6%9C%89%E4%BA%9B%E7%BB%95%E5%93%88%EF%BC%8C%E6%AF%94%E6%96%B9%E8%AF%B4%E4%B8%8B%E8%BE%B9%E8%BF%99%E4%B8%AA%E6%9F%A5%E8%AF%A2%EF%BC%9A%0AEXPLAIN%20SELECT%20*%20FROM%20s1%20WHERE%20key1%20IN%20(SELECT%20key1%20FROM%20s2%20WHERE%20key1%20%3D%20'a'%20UNION%20SELECT%20key1%20FROM%20s1%20WHERE%20key1%20%3D%20'b')%3B!%5Bd8507f92b81b5fdcfe6d36ff5eda098a.png%5D(en-resource%3A%2F%2Fdatabase%2F860%3A1)%0A%E8%BF%99%E4%B8%AA%E6%9F%A5%E8%AF%A2%E6%AF%94%E8%BE%83%E5%A4%8D%E6%9D%82%E5%95%8A%EF%BC%8C%E5%A4%A7%E6%9F%A5%E8%AF%A2%E9%87%8C%E5%8C%85%E5%90%AB%E4%BA%86%E4%B8%80%E4%B8%AA%E5%AD%90%E6%9F%A5%E8%AF%A2%EF%BC%8C%E5%AD%90%E6%9F%A5%E8%AF%A2%E9%87%8C%E5%8F%88%E6%98%AF%E7%94%B1UNION%E8%BF%9E%E8%B5%B7%E6%9D%A5%E7%9A%84%E4%B8%A4%E4%B8%AA%E5%B0%8F%E6%9F%A5%E8%AF%A2%E3%80%82%E4%BB%8E%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E4%B8%AD%E5%8F%AF%E4%BB%A5%E7%9C%8B%E5%87%BA%E6%9D%A5%EF%BC%8CSELECT%20key1%20FROM%20s2%20WHERE%20key1%20%3D%20'a'%E8%BF%99%E4%B8%AA%E5%B0%8F%E6%9F%A5%E8%AF%A2%E7%94%B1%E4%BA%8E%E6%98%AF%E5%AD%90%E6%9F%A5%E8%AF%A2%E4%B8%AD%E7%AC%AC%E4%B8%80%E4%B8%AA%E6%9F%A5%E8%AF%A2%EF%BC%8C%E6%89%80%E4%BB%A5%E5%AE%83%E7%9A%84select_type%E6%98%AFDEPENDENT%20SUBQUERY%EF%BC%8C%E8%80%8CSELECT%20key1%20FROM%20s1%20WHERE%20key1%20%3D%20'b'%E8%BF%99%E4%B8%AA%E6%9F%A5%E8%AF%A2%E7%9A%84select_type%E5%B0%B1%E6%98%AFDEPENDENT%20UNION%E3%80%82%0A%0A*%20**DERIVED**%0A%E5%AF%B9%E4%BA%8E%E9%87%87%E7%94%A8%E7%89%A9%E5%8C%96%E7%9A%84%E6%96%B9%E5%BC%8F%E6%89%A7%E8%A1%8C%E7%9A%84%E5%8C%85%E5%90%AB%E6%B4%BE%E7%94%9F%E8%A1%A8%E7%9A%84%E6%9F%A5%E8%AF%A2%EF%BC%9A%0A!%5Baa46239a4d7eedbf37f02b66e57eaceb.png%5D(en-resource%3A%2F%2Fdatabase%2F862%3A1)%0A%E5%A6%82%E6%9E%9C%E6%B4%BE%E7%94%9F%E8%A1%A8%E5%8F%AF%E4%BB%A5%E9%80%9A%E8%BF%87%E5%92%8C%E5%A4%96%E5%B1%82%E6%9F%A5%E8%AF%A2%E5%90%88%E5%B9%B6%E7%9A%84%E6%96%B9%E5%BC%8F%E6%89%A7%E8%A1%8C%E7%9A%84%E8%AF%9D%EF%BC%8C%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E5%8F%88%E6%98%AF%E5%8F%A6%E4%B8%80%E7%95%AA%E6%99%AF%E8%B1%A1%E3%80%82%0A%0A*%20**MATERIALIZED**%0A%E5%BD%93%E6%9F%A5%E8%AF%A2%E4%BC%98%E5%8C%96%E5%99%A8%E5%9C%A8%E6%89%A7%E8%A1%8C%E5%8C%85%E5%90%AB%E5%AD%90%E6%9F%A5%E8%AF%A2%E7%9A%84%E8%AF%AD%E5%8F%A5%E6%97%B6%EF%BC%8C%E9%80%89%E6%8B%A9%E5%B0%86%E5%AD%90%E6%9F%A5%E8%AF%A2%E7%89%A9%E5%8C%96%E4%B9%8B%E5%90%8E%E5%86%8D%E4%B8%8E%E5%A4%96%E5%B1%82%E6%9F%A5%E8%AF%A2%E8%BF%9B%E8%A1%8C%E8%BF%9E%E6%8E%A5%E6%9F%A5%E8%AF%A2%EF%BC%8C%E8%AF%A5%E5%AD%90%E6%9F%A5%E8%AF%A2%E5%AF%B9%E5%BA%94%E7%9A%84select_type%E5%B0%B1%E6%98%AFMATERIALIZED%EF%BC%88%E6%98%AFsemi-join%E7%9A%84%E4%B8%80%E7%A7%8D%EF%BC%89%EF%BC%9A%0A!%5Bb01733808270112b22be7aadf0ae4fed.png%5D(en-resource%3A%2F%2Fdatabase%2F864%3A1)%0A%0A%23%23%23%20type%0Atype%E4%BB%A3%E8%A1%A8%E5%AF%B9%E6%9F%90%E4%B8%AA%E8%A1%A8%E7%9A%84%E6%89%A7%E8%A1%8C%E6%9F%A5%E8%AF%A2%E6%97%B6%E7%9A%84%E8%AE%BF%E9%97%AE%E6%96%B9%E6%B3%95%E3%80%82%E5%AE%8C%E6%95%B4%E7%9A%84%E8%AE%BF%E9%97%AE%E6%96%B9%E6%B3%95%E5%A6%82%E4%B8%8B%EF%BC%9A**system%EF%BC%8Cconst%EF%BC%8Ceq_ref%EF%BC%8Cref%EF%BC%8Cfulltext%EF%BC%8Cref_or_null%EF%BC%8Cindex_merge%EF%BC%8Cunique_subquery%EF%BC%8Cindex_subquery%EF%BC%8Crange%EF%BC%8Cindex%EF%BC%8CALL%E3%80%82**%0A%0A*%20**system**%0A%E5%BD%93%E8%A1%A8%E4%B8%AD%E5%8F%AA%E6%9C%89%E4%B8%80%E6%9D%A1%E8%AE%B0%E5%BD%95%E5%B9%B6%E4%B8%94%E8%AF%A5%E8%A1%A8%E4%BD%BF%E7%94%A8%E7%9A%84%E5%AD%98%E5%82%A8%E5%BC%95%E6%93%8E%E7%9A%84%E7%BB%9F%E8%AE%A1%E6%95%B0%E6%8D%AE%E6%98%AF%E7%B2%BE%E7%A1%AE%E7%9A%84%EF%BC%8C%E6%AF%94%E5%A6%82MyISAM%E3%80%81Memory%EF%BC%8C%E9%82%A3%E4%B9%88%E5%AF%B9%E8%AF%A5%E8%A1%A8%E7%9A%84%E8%AE%BF%E9%97%AE%E6%96%B9%E6%B3%95%E5%B0%B1%E6%98%AFsystem%E3%80%82%0A!%5Bda790d151cf04b6c1578dc3fdb044d73.png%5D(en-resource%3A%2F%2Fdatabase%2F866%3A1)%0A%0A*%20**const**%0A%E6%A0%B9%E6%8D%AE%E4%B8%BB%E9%94%AE%E6%88%96%E8%80%85%E5%94%AF%E4%B8%80%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E5%88%97%E4%B8%8E%E5%B8%B8%E6%95%B0%E8%BF%9B%E8%A1%8C%E7%AD%89%E5%80%BC%EF%BC%88NULL%E5%80%BC%E7%89%B9%E6%AE%8A%EF%BC%89%E5%8C%B9%E9%85%8D%E6%97%B6%EF%BC%8C%E5%AF%B9%E5%8D%95%E8%A1%A8%E7%9A%84%E8%AE%BF%E9%97%AE%E6%96%B9%E6%B3%95%E5%B0%B1%E6%98%AFconst%E3%80%82!%5B3a8df3adcfa5f3a1c280526d5eb70c27.png%5D(en-resource%3A%2F%2Fdatabase%2F868%3A1)%0A%0A*%20**eq_ref**%0A%E5%9C%A8**%E8%BF%9E%E6%8E%A5%E6%9F%A5%E8%AF%A2**%E6%97%B6%EF%BC%8C%E5%A6%82%E6%9E%9C%E8%A2%AB%E9%A9%B1%E5%8A%A8%E8%A1%A8%E6%98%AF%E9%80%9A%E8%BF%87%E4%B8%BB%E9%94%AE%E6%88%96%E8%80%85%E5%94%AF%E4%B8%80%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E5%88%97%E7%AD%89%E5%80%BC%EF%BC%88NULL%E5%80%BC%E7%89%B9%E6%AE%8A%EF%BC%89%E5%8C%B9%E9%85%8D%E7%9A%84%E6%96%B9%E5%BC%8F%E8%BF%9B%E8%A1%8C%E8%AE%BF%E9%97%AE%E7%9A%84%EF%BC%88%E5%A6%82%E6%9E%9C%E8%AF%A5%E4%B8%BB%E9%94%AE%E6%88%96%E8%80%85%E5%94%AF%E4%B8%80%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E6%98%AF%E8%81%94%E5%90%88%E7%B4%A2%E5%BC%95%E7%9A%84%E8%AF%9D%EF%BC%8C%E6%89%80%E6%9C%89%E7%9A%84%E7%B4%A2%E5%BC%95%E5%88%97%E9%83%BD%E5%BF%85%E9%A1%BB%E8%BF%9B%E8%A1%8C%E7%AD%89%E5%80%BC%E6%AF%94%E8%BE%83%EF%BC%89%EF%BC%8C%E5%88%99%E5%AF%B9%E8%AF%A5%E8%A2%AB%E9%A9%B1%E5%8A%A8%E8%A1%A8%E7%9A%84%E8%AE%BF%E9%97%AE%E6%96%B9%E6%B3%95%E5%B0%B1%E6%98%AFeq_ref%EF%BC%8C%E6%AF%94%E6%96%B9%E8%AF%B4%EF%BC%9A!%5B82dee91cf24596f470ba65c2a50fbc4e.png%5D(en-resource%3A%2F%2Fdatabase%2F870%3A1)%0A%0A*%20**ref**%0A%E5%BD%93%E9%80%9A%E8%BF%87%E6%99%AE%E9%80%9A%E7%9A%84%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E5%88%97%E4%B8%8E%E5%B8%B8%E9%87%8F%E8%BF%9B%E8%A1%8C%E7%AD%89%E5%80%BC%E5%8C%B9%E9%85%8D%E6%97%B6%E6%9D%A5%E6%9F%A5%E8%AF%A2%E6%9F%90%E4%B8%AA%E8%A1%A8%EF%BC%8C%E9%82%A3%E4%B9%88%E5%AF%B9%E8%AF%A5%E8%A1%A8%E7%9A%84%20%E8%AE%BF%E9%97%AE%E6%96%B9%E6%B3%95%E5%B0%B1%E5%8F%AF%E8%83%BD%E6%98%AFref%E3%80%82%0A%0A*%20**fulltext**%0A%E5%85%A8%E6%96%87%E7%B4%A2%E5%BC%95%0A%0A*%20**ref_or_null**%0A%E5%BD%93%E5%AF%B9%E6%99%AE%E9%80%9A%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%BF%9B%E8%A1%8C%E7%AD%89%E5%80%BC%E5%8C%B9%E9%85%8D%E6%9F%A5%E8%AF%A2%EF%BC%8C%E8%AF%A5%E7%B4%A2%E5%BC%95%E5%88%97%E7%9A%84%E5%80%BC%E4%B9%9F%E5%8F%AF%E4%BB%A5%E6%98%AFNULL%E5%80%BC%E6%97%B6%EF%BC%8C%E9%82%A3%E4%B9%88%E5%AF%B9%E8%AF%A5%E8%A1%A8%E7%9A%84%E8%AE%BF%E9%97%AE%E6%96%B9%E6%B3%95%E5%B0%B1%E5%8F%AF%E8%83%BD%E6%98%AFref_or_null%EF%BC%8C%E6%AF%94%E5%A6%82%E8%AF%B4%EF%BC%9A!%5Bc03397ffd67f90215e034d87568f02d7.png%5D(en-resource%3A%2F%2Fdatabase%2F872%3A1)%0A%0A*%20**index_merge**%0A%E4%B8%80%E8%88%AC%E6%83%85%E5%86%B5%E4%B8%8B%E5%AF%B9%E4%BA%8E%E6%9F%90%E4%B8%AA%E8%A1%A8%E7%9A%84%E6%9F%A5%E8%AF%A2%E5%8F%AA%E8%83%BD%E4%BD%BF%E7%94%A8%E5%88%B0%E4%B8%80%E4%B8%AA%E7%B4%A2%E5%BC%95%EF%BC%8C%E4%BD%86%E8%AE%B2%E5%8D%95%E8%A1%A8%E8%AE%BF%E9%97%AE%E6%96%B9%E6%B3%95%E6%97%B6%E7%89%B9%E6%84%8F%E5%BC%BA%E8%B0%83%E4%BA%86%E5%9C%A8%E6%9F%90%E4%BA%9B%E5%9C%BA%E6%99%AF%E4%B8%8B%E5%8F%AF%E4%BB%A5%E4%BD%BF%E7%94%A8Intersection%E3%80%81Union%E3%80%81Sort-Union%E8%BF%99%E4%B8%89%E7%A7%8D**%E7%B4%A2%E5%BC%95%E5%90%88%E5%B9%B6**%E7%9A%84%E6%96%B9%E5%BC%8F%E6%9D%A5%E6%89%A7%E8%A1%8C%E6%9F%A5%E8%AF%A2%EF%BC%9A!%5B2354fa00cbd7f83a91dc53de071d7378.png%5D(en-resource%3A%2F%2Fdatabase%2F874%3A1)%0A%0A*%20**unique_subquery**%0A%E7%B1%BB%E4%BC%BC%E4%BA%8E%E4%B8%A4%E8%A1%A8%E8%BF%9E%E6%8E%A5%E4%B8%AD%E8%A2%AB%E9%A9%B1%E5%8A%A8%E8%A1%A8%E7%9A%84eq_ref%E8%AE%BF%E9%97%AE%E6%96%B9%E6%B3%95%EF%BC%8Cunique_subquery%E6%98%AF%E9%92%88%E5%AF%B9%E5%9C%A8%E4%B8%80%E4%BA%9B%E5%8C%85%E5%90%ABIN%E5%AD%90%E6%9F%A5%E8%AF%A2%E7%9A%84%E6%9F%A5%E8%AF%A2%E8%AF%AD%E5%8F%A5%E4%B8%AD%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%9F%A5%E8%AF%A2%E4%BC%98%E5%8C%96%E5%99%A8%E5%86%B3%E5%AE%9A%E5%B0%86IN%E5%AD%90%E6%9F%A5%E8%AF%A2%E8%BD%AC%E6%8D%A2%E4%B8%BAEXISTS%E5%AD%90%E6%9F%A5%E8%AF%A2%EF%BC%8C%E8%80%8C%E4%B8%94%E5%AD%90%E6%9F%A5%E8%AF%A2%E5%8F%AF%E4%BB%A5%E4%BD%BF%E7%94%A8%E5%88%B0%E4%B8%BB%E9%94%AE%E8%BF%9B%E8%A1%8C%E7%AD%89%E5%80%BC%E5%8C%B9%E9%85%8D%E7%9A%84%E8%AF%9D%EF%BC%8C%E9%82%A3%E4%B9%88%E8%AF%A5%E5%AD%90%E6%9F%A5%E8%AF%A2%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E7%9A%84type%E5%88%97%E7%9A%84%E5%80%BC%E5%B0%B1%E6%98%AFunique_subquery%EF%BC%8C%E6%AF%94%E5%A6%82%E4%B8%8B%E8%BE%B9%E7%9A%84%E8%BF%99%E4%B8%AA%E6%9F%A5%E8%AF%A2%E8%AF%AD%E5%8F%A5%EF%BC%9A!%5B82976d2077e28b9462a3ba3c080ed2a2.png%5D(en-resource%3A%2F%2Fdatabase%2F876%3A1)%0A%0A*%20**index_subquery**%0Aindex_subquery%E4%B8%8Eunique_subquery%E7%B1%BB%E4%BC%BC%EF%BC%8C%E5%8F%AA%E4%B8%8D%E8%BF%87%E8%AE%BF%E9%97%AE%E5%AD%90%E6%9F%A5%E8%AF%A2%E4%B8%AD%E7%9A%84%E8%A1%A8%E6%97%B6%E4%BD%BF%E7%94%A8%E7%9A%84%E6%98%AF%E6%99%AE%E9%80%9A%E7%9A%84%E7%B4%A2%E5%BC%95%EF%BC%8C%E6%AF%94%E5%A6%82%E8%BF%99%E6%A0%B7%EF%BC%9A!%5Bf8e9008ebf933bcdd21696b67f6675fb.png%5D(en-resource%3A%2F%2Fdatabase%2F878%3A1)%0A%0A*%20**range**%0A%E5%A6%82%E6%9E%9C%E4%BD%BF%E7%94%A8%E7%B4%A2%E5%BC%95%E8%8E%B7%E5%8F%96%E6%9F%90%E4%BA%9B%E8%8C%83%E5%9B%B4%E5%8C%BA%E9%97%B4%E7%9A%84%E8%AE%B0%E5%BD%95%EF%BC%8C%E9%82%A3%E4%B9%88%E5%B0%B1%E5%8F%AF%E8%83%BD%E4%BD%BF%E7%94%A8%E5%88%B0range%E8%AE%BF%E9%97%AE%E6%96%B9%E6%B3%95%EF%BC%8C%E6%AF%94%E5%A6%82%E4%B8%8B%E8%BE%B9%E7%9A%84%E8%BF%99%E4%B8%AA%E6%9F%A5%E8%AF%A2%EF%BC%9A!%5Bd2f8fdc1cacd57e0cbb956672d4e95fc.png%5D(en-resource%3A%2F%2Fdatabase%2F880%3A1)%0A%0A*%20**index**%0A%E4%BD%BF%E7%94%A8%E7%B4%A2%E5%BC%95%E8%A6%86%E7%9B%96%EF%BC%8C%E4%BD%86%E9%9C%80%E8%A6%81%E6%89%AB%E6%8F%8F%E5%85%A8%E9%83%A8%E7%9A%84%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E6%97%B6%EF%BC%8C%E8%AF%A5%E8%A1%A8%E7%9A%84%E8%AE%BF%E9%97%AE%E6%96%B9%E6%B3%95%E5%B0%B1%E6%98%AFindex%EF%BC%8C%E6%AF%94%E5%A6%82%E8%BF%99%E6%A0%B7%EF%BC%9A!%5B39023b9b49dad02a61df331df1c49420.png%5D(en-resource%3A%2F%2Fdatabase%2F882%3A1)%0A%0A*%20**ALL**%0A%E5%85%A8%E8%A1%A8%E6%89%AB%E6%8F%8F!%5B1d2f5de5664d197afa0fb7b36ff2169b.png%5D(en-resource%3A%2F%2Fdatabase%2F884%3A1)%0A%0A%0A%E4%B8%80%E8%88%AC%E6%9D%A5%E8%AF%B4%EF%BC%8C%E8%BF%99%E4%BA%9B%E8%AE%BF%E9%97%AE%E6%96%B9%E6%B3%95%E6%8C%89%E7%85%A7%E6%88%91%E4%BB%AC%E4%BB%8B%E7%BB%8D%E5%AE%83%E4%BB%AC%E7%9A%84%E9%A1%BA%E5%BA%8F%E6%80%A7%E8%83%BD%E4%BE%9D%E6%AC%A1%E5%8F%98%E5%B7%AE%E3%80%82%E5%85%B6%E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B8%8B%E8%BE%B9%E8%BF%99%E4%B8%AA%E6%9F%A5%E8%AF%A2%EF%BC%9A!%5B2ac79b15b9368105bee2aa7d6f4467a6.png%5D(en-resource%3A%2F%2Fdatabase%2F886%3A1)%0A%E4%B8%8A%E8%BF%B0%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E7%9A%84possible_keys%E5%88%97%E7%9A%84%E5%80%BC%E6%98%AFidx_key1%2Cidx_key3%EF%BC%8C%E8%A1%A8%E7%A4%BA%E8%AF%A5%E6%9F%A5%E8%AF%A2%E5%8F%AF%E8%83%BD%E4%BD%BF%E7%94%A8%E5%88%B0idx_key1%2Cidx_key3%E4%B8%A4%E4%B8%AA%E7%B4%A2%E5%BC%95%EF%BC%8C%E7%84%B6%E5%90%8Ekey%E5%88%97%E7%9A%84%E5%80%BC%E6%98%AFidx_key3%EF%BC%8C%E8%A1%A8%E7%A4%BA%E7%BB%8F%E8%BF%87%E6%9F%A5%E8%AF%A2%E4%BC%98%E5%8C%96%E5%99%A8%E8%AE%A1%E7%AE%97%E4%BD%BF%E7%94%A8%E4%B8%8D%E5%90%8C%E7%B4%A2%E5%BC%95%E7%9A%84%E6%88%90%E6%9C%AC%E5%90%8E%EF%BC%8C%E6%9C%80%E5%90%8E%E5%86%B3%E5%AE%9A%E4%BD%BF%E7%94%A8idx_key3%E6%9D%A5%E6%89%A7%E8%A1%8C%E6%9F%A5%E8%AF%A2%E6%AF%94%E8%BE%83%E5%88%92%E7%AE%97%E3%80%82%0A%0A%E4%B8%8D%E8%BF%87%E6%9C%89%E4%B8%80%E7%A7%8D%E6%83%85%E5%86%B5%E6%AF%94%E8%BE%83%E7%89%B9%E6%AE%8A%EF%BC%9A%0A*%20**type%E4%B8%BAindex%EF%BC%88%E8%A6%86%E7%9B%96%E7%B4%A2%E5%BC%95%EF%BC%89%E7%9A%84%E8%AE%BF%E9%97%AE%E6%96%B9%E5%BC%8F**%0A%E5%9C%A8%E4%BD%BF%E7%94%A8index%E8%AE%BF%E9%97%AE%E6%96%B9%E6%B3%95%E6%9D%A5%E6%9F%A5%E8%AF%A2%E6%9F%90%E4%B8%AA%E8%A1%A8%E6%97%B6%EF%BC%8Cpossible_keys%E5%88%97%E6%98%AF%E7%A9%BA%E7%9A%84%EF%BC%8C%E8%80%8Ckey%E5%88%97%E5%B1%95%E7%A4%BA%E7%9A%84%E6%98%AF%E5%AE%9E%E9%99%85%E4%BD%BF%E7%94%A8%E5%88%B0%E7%9A%84%E7%B4%A2%E5%BC%95%EF%BC%8C%E6%AF%94%E5%A6%82%E8%BF%99%E6%A0%B7%EF%BC%9A%0A!%5B7cb81a7e2178f59819a2e30c17c20c85.png%5D(en-resource%3A%2F%2Fdatabase%2F888%3A1)%0A%0A%0A%E5%8F%A6%E5%A4%96%E9%9C%80%E8%A6%81%E6%B3%A8%E6%84%8F%E7%9A%84%E4%B8%80%E7%82%B9%E6%98%AF%EF%BC%8C**possible_keys%E5%88%97%E4%B8%AD%E7%9A%84%E5%80%BC%E5%B9%B6%E4%B8%8D%E6%98%AF%E8%B6%8A%E5%A4%9A%E8%B6%8A%E5%A5%BD%EF%BC%8C%E5%8F%AF%E8%83%BD%E4%BD%BF%E7%94%A8%E7%9A%84%E7%B4%A2%E5%BC%95%E8%B6%8A%E5%A4%9A%EF%BC%8C%E6%9F%A5%E8%AF%A2%E4%BC%98%E5%8C%96%E5%99%A8%E8%AE%A1%E7%AE%97%E6%9F%A5%E8%AF%A2%E6%88%90%E6%9C%AC%E6%97%B6%E5%B0%B1%E5%BE%97%E8%8A%B1%E8%B4%B9%E6%9B%B4%E9%95%BF%E6%97%B6%E9%97%B4%EF%BC%8C%E6%89%80%E4%BB%A5%E5%A6%82%E6%9E%9C%E5%8F%AF%E4%BB%A5%E7%9A%84%E8%AF%9D%EF%BC%8C%E5%B0%BD%E9%87%8F%E5%88%A0%E9%99%A4%E9%82%A3%E4%BA%9B%E7%94%A8%E4%B8%8D%E5%88%B0%E7%9A%84%E7%B4%A2%E5%BC%95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7%94%A8%E7%9A%84%E5%AD%97%E7%AC%A6%E9%9B%86%E6%98%AFutf8%EF%BC%8C%E9%82%A3%E4%B9%88%E8%AF%A5%E5%88%97%E5%AE%9E%E9%99%85%E5%8D%A0%E7%94%A8%E7%9A%84%E6%9C%80%E5%A4%A7%E5%AD%98%E5%82%A8%E7%A9%BA%E9%97%B4%E5%B0%B1%E6%98%AF100%20%C3%97%203%20%3D%20300%E4%B8%AA%E5%AD%97%E8%8A%82%EF%BC%9B%0A*%20%E5%A6%82%E6%9E%9C%E8%AF%A5%E7%B4%A2%E5%BC%95%E5%88%97%E5%8F%AF%E4%BB%A5%E5%AD%98%E5%82%A8NULL%E5%80%BC%EF%BC%8C%E5%88%99key_len%E6%AF%94%E4%B8%8D%E5%8F%AF%E4%BB%A5%E5%AD%98%E5%82%A8NULL%E5%80%BC%E6%97%B6%E5%A4%9A1%E4%B8%AA%E5%AD%97%E8%8A%82%EF%BC%9B%0A*%20%E5%AF%B9%E4%BA%8E%E5%8F%98%E9%95%BF%E5%AD%97%E6%AE%B5%E6%9D%A5%E8%AF%B4%EF%BC%8C%E9%83%BD%E4%BC%9A%E6%9C%892%E4%B8%AA%E5%AD%97%E8%8A%82%E7%9A%84%E7%A9%BA%E9%97%B4%E6%9D%A5%E5%AD%98%E5%82%A8%E8%AF%A5%E5%8F%98%E9%95%BF%E5%88%97%E7%9A%84%E5%AE%9E%E9%99%85%E9%95%BF%E5%BA%A6%E3%80%82%0A%0A!%5B288733f6fb0c28fff6e6535ec5876ec9.png%5D(en-resource%3A%2F%2Fdatabase%2F890%3A1)%0A%0A%E7%94%B1%E4%BA%8Eid%E5%88%97%E7%9A%84%E7%B1%BB%E5%9E%8B%E6%98%AFINT%EF%BC%8C%E5%B9%B6%E4%B8%94%E4%B8%8D%E5%8F%AF%E4%BB%A5%E5%AD%98%E5%82%A8NULL%E5%80%BC%EF%BC%8C%E6%89%80%E4%BB%A5%E5%9C%A8%E4%BD%BF%E7%94%A8%E8%AF%A5%E5%88%97%E7%9A%84%E7%B4%A2%E5%BC%95%E6%97%B6key_len%E5%A4%A7%E5%B0%8F%E5%B0%B1%E6%98%AF4%E3%80%82%E5%BD%93%E7%B4%A2%E5%BC%95%E5%88%97%E5%8F%AF%E4%BB%A5%E5%AD%98%E5%82%A8NULL%E5%80%BC%E6%97%B6%EF%BC%8C%E6%AF%94%E5%A6%82%EF%BC%9A!%5B8138a171ab7162978152ad206c732b31.png%5D(en-resource%3A%2F%2Fdatabase%2F892%3A1)%0A%0A%E5%AF%B9%E4%BA%8E%E5%8F%AF%E5%8F%98%E9%95%BF%E5%BA%A6%E7%9A%84%E7%B4%A2%E5%BC%95%E5%88%97%E6%9D%A5%E8%AF%B4%EF%BC%8C%E6%AF%94%E5%A6%82%E4%B8%8B%E8%BE%B9%E8%BF%99%E4%B8%AA%E6%9F%A5%E8%AF%A2%EF%BC%9A!%5B3a40b2d8ba2da995bec68e554fd93f6c.png%5D(en-resource%3A%2F%2Fdatabase%2F894%3A1)%0A%E7%94%B1%E4%BA%8Ekey1%E5%88%97%E7%9A%84%E7%B1%BB%E5%9E%8B%E6%98%AFVARCHAR(100)%EF%BC%8C%E6%89%80%E4%BB%A5%E8%AF%A5%E5%88%97%E5%AE%9E%E9%99%85%E6%9C%80%E5%A4%9A%E5%8D%A0%E7%94%A8%E7%9A%84%E5%AD%98%E5%82%A8%E7%A9%BA%E9%97%B4%E5%B0%B1%E6%98%AF300%E5%AD%97%E8%8A%82%EF%BC%8C%E5%8F%88%E5%9B%A0%E4%B8%BA%E8%AF%A5%E5%88%97%E5%85%81%E8%AE%B8%E5%AD%98%E5%82%A8NULL%E5%80%BC%EF%BC%8C%E6%89%80%E4%BB%A5key_len%E9%9C%80%E8%A6%81%E5%8A%A01%EF%BC%8C%E5%8F%88%E5%9B%A0%E4%B8%BA%E8%AF%A5%E5%88%97%E6%98%AF%E5%8F%AF%E5%8F%98%E9%95%BF%E5%BA%A6%E5%88%97%EF%BC%8C%E6%89%80%E4%BB%A5key_len%E9%9C%80%E8%A6%81%E5%8A%A02%EF%BC%8C%E6%89%80%E4%BB%A5%E6%9C%80%E5%90%8Eken_len%E7%9A%84%E5%80%BC%E5%B0%B1%E6%98%AF303%E3%80%82%0A%0A%0A%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E7%9A%84%E7%94%9F%E6%88%90%E6%98%AF%E5%9C%A8MySQL%20server%E5%B1%82%E4%B8%AD%E7%9A%84%E5%8A%9F%E8%83%BD%EF%BC%8C%E5%B9%B6%E4%B8%8D%E6%98%AF%E9%92%88%E5%AF%B9%E5%85%B7%E4%BD%93%E6%9F%90%E4%B8%AA%E5%AD%98%E5%82%A8%E5%BC%95%E6%93%8E%E7%9A%84%E5%8A%9F%E8%83%BD%EF%BC%8C%E8%AE%BE%E8%AE%A1MySQL%E7%9A%84%E5%A4%A7%E5%8F%94%E5%9C%A8%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E4%B8%AD%E8%BE%93%E5%87%BAkey_len%E5%88%97%E4%B8%BB%E8%A6%81%E6%98%AF%E4%B8%BA%E4%BA%86%E8%AE%A9%E6%88%91%E4%BB%AC%E5%8C%BA%E5%88%86%E6%9F%90%E4%B8%AA%E4%BD%BF%E7%94%A8%E8%81%94%E5%90%88%E7%B4%A2%E5%BC%95%E7%9A%84%E6%9F%A5%E8%AF%A2%E5%85%B7%E4%BD%93%E7%94%A8%E4%BA%86%E5%87%A0%E4%B8%AA%E7%B4%A2%E5%BC%95%E5%88%97%EF%BC%8C%E8%80%8C%E4%B8%8D%E6%98%AF%E4%B8%BA%E4%BA%86%E5%87%86%E7%A1%AE%E7%9A%84%E8%AF%B4%E6%98%8E%E9%92%88%E5%AF%B9%E6%9F%90%E4%B8%AA%E5%85%B7%E4%BD%93%E5%AD%98%E5%82%A8%E5%BC%95%E6%93%8E%E5%AD%98%E5%82%A8%E5%8F%98%E9%95%BF%E5%AD%97%E6%AE%B5%E7%9A%84%E5%AE%9E%E9%99%85%E9%95%BF%E5%BA%A6%E5%8D%A0%E7%94%A8%E7%9A%84%E7%A9%BA%E9%97%B4%E5%88%B0%E5%BA%95%E6%98%AF%E5%8D%A0%E7%94%A81%E4%B8%AA%E5%AD%97%E8%8A%82%E8%BF%98%E6%98%AF2%E4%B8%AA%E5%AD%97%E8%8A%82%E3%80%82%E6%AF%94%E6%96%B9%E8%AF%B4%E4%B8%8B%E8%BE%B9%E8%BF%99%E4%B8%AA%E4%BD%BF%E7%94%A8%E5%88%B0%E8%81%94%E5%90%88%E7%B4%A2%E5%BC%95idx_key_part%E7%9A%84%E6%9F%A5%E8%AF%A2%EF%BC%9A!%5Bdbd3b954304a06f8934241c3cdbe8001.png%5D(en-resource%3A%2F%2Fdatabase%2F896%3A1)%0A%0A%E8%BF%99%E4%B8%AA%E6%9F%A5%E8%AF%A2%E7%9A%84%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E7%9A%84ken_len%E5%88%97%E7%9A%84%E5%80%BC%E6%98%AF606%EF%BC%8C%E8%AF%B4%E6%98%8E%E6%89%A7%E8%A1%8C%E8%BF%99%E4%B8%AA%E6%9F%A5%E8%AF%A2%E7%9A%84%E6%97%B6%E5%80%99%E5%8F%AF%E4%BB%A5%E7%94%A8%E5%88%B0%E8%81%94%E5%90%88%E7%B4%A2%E5%BC%95idx_key_part%E7%9A%84%E4%B8%A4%E4%B8%AA%E7%B4%A2%E5%BC%95%E5%88%97%E3%80%82%0A%0A%23%23%23%20ref%0A%0A%E5%BD%93%E4%BD%BF%E7%94%A8%E7%B4%A2%E5%BC%95%E5%88%97%E7%AD%89%E5%80%BC%E5%8C%B9%E9%85%8D%E7%9A%84%E6%9D%A1%E4%BB%B6%E5%8E%BB%E6%89%A7%E8%A1%8C%E6%9F%A5%E8%AF%A2%E6%97%B6%EF%BC%8C%E4%B9%9F%E5%B0%B1%E6%98%AF%E5%9C%A8%E8%AE%BF%E9%97%AE%E6%96%B9%E6%B3%95%E6%98%AFconst%E3%80%81eq_ref%E3%80%81ref%E3%80%81ref_or_null%E3%80%81unique_subquery%E3%80%81index_subquery%E5%85%B6%E4%B8%AD%E4%B9%8B%E4%B8%80%E6%97%B6%EF%BC%8Cref%E5%88%97%E5%B1%95%E7%A4%BA%E7%9A%84%E5%B0%B1%E6%98%AF%E4%B8%8E%E7%B4%A2%E5%BC%95%E5%88%97%E4%BD%9C%E7%AD%89%E5%80%BC%E5%8C%B9%E9%85%8D%E7%9A%84%E4%B8%9C%E4%B8%9C%E6%98%AF%E4%B8%AA%E5%95%A5%EF%BC%8C%E6%AF%94%E5%A6%82%E5%8F%AA%E6%98%AF%E4%B8%80%E4%B8%AA%E5%B8%B8%E6%95%B0%E6%88%96%E8%80%85%E6%98%AF%E6%9F%90%E4%B8%AA%E5%88%97%E3%80%82%E5%A4%A7%E5%AE%B6%E7%9C%8B%E4%B8%8B%E8%BE%B9%E8%BF%99%E4%B8%AA%E6%9F%A5%E8%AF%A2%EF%BC%9A!%5Beef1a67a9262b96397b1b55e96d8f52d.png%5D(en-resource%3A%2F%2Fdatabase%2F898%3A1)%0A%0A%0A%E5%8F%AF%E4%BB%A5%E7%9C%8B%E5%88%B0ref%E5%88%97%E7%9A%84%E5%80%BC%E6%98%AFconst%EF%BC%8C%E8%A1%A8%E6%98%8E%E5%9C%A8%E4%BD%BF%E7%94%A8idx_key1%E7%B4%A2%E5%BC%95%E6%89%A7%E8%A1%8C%E6%9F%A5%E8%AF%A2%E6%97%B6%EF%BC%8C%E4%B8%8Ekey1%E5%88%97%E4%BD%9C%E7%AD%89%E5%80%BC%E5%8C%B9%E9%85%8D%E7%9A%84%E5%AF%B9%E8%B1%A1%E6%98%AF%E4%B8%80%E4%B8%AA%E5%B8%B8%E6%95%B0%EF%BC%8C%E5%BD%93%E7%84%B6%E6%9C%89%E6%97%B6%E5%80%99%E6%9B%B4%E5%A4%8D%E6%9D%82%E4%B8%80%E7%82%B9%EF%BC%9A!%5B517665873f7ba7dbafea5cdd34699672.png%5D(en-resource%3A%2F%2Fdatabase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C%E8%AE%A1%E5%88%92%E7%9A%84rows%E5%88%97%E5%B0%B1%E4%BB%A3%E8%A1%A8%E9%A2%84%E8%AE%A1%E9%9C%80%E8%A6%81%E6%89%AB%E6%8F%8F%E7%9A%84%E8%A1%8C%E6%95%B0%EF%BC%8C%E5%A6%82%E6%9E%9C%E4%BD%BF%E7%94%A8%E7%B4%A2%E5%BC%95%E6%9D%A5%E6%89%A7%E8%A1%8C%E6%9F%A5%E8%AF%A2%E6%97%B6%EF%BC%8C%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E7%9A%84rows%E5%88%97%E5%B0%B1%E4%BB%A3%E8%A1%A8%E9%A2%84%E8%AE%A1%E6%89%AB%E6%8F%8F%E7%9A%84%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%E8%A1%8C%E6%95%B0%E3%80%82%E6%AF%94%E5%A6%82%E4%B8%8B%E8%BE%B9%E8%BF%99%E4%B8%AA%E6%9F%A5%E8%AF%A2%EF%BC%9A!%5Be3955247f7c7af396723a39dc8fe32df.png%5D(en-resource%3A%2F%2Fdatabase%2F904%3A1)%0A%E5%88%B0%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E7%9A%84rows%E5%88%97%E7%9A%84%E5%80%BC%E6%98%AF266%EF%BC%8C%E8%BF%99%E6%84%8F%E5%91%B3%E7%9D%80%E6%9F%A5%E8%AF%A2%E4%BC%98%E5%8C%96%E5%99%A8%E5%9C%A8%E7%BB%8F%E8%BF%87%E5%88%86%E6%9E%90%E4%BD%BF%E7%94%A8idx_key1%E8%BF%9B%E8%A1%8C%E6%9F%A5%E8%AF%A2%E7%9A%84%E6%88%90%E6%9C%AC%E4%B9%8B%E5%90%8E%EF%BC%8C%E8%A7%89%E5%BE%97%E6%BB%A1%E8%B6%B3key1%20%3E%20'z'%E8%BF%99%E4%B8%AA%E6%9D%A1%E4%BB%B6%E7%9A%84%E8%AE%B0%E5%BD%95%E5%8F%AA%E6%9C%89266%E6%9D%A1%E3%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%A8%E6%89%87%E5%87%BA%E7%9A%84%E6%97%B6%E5%80%99%E9%9C%80%E8%A6%81%E4%BC%B0%E8%AE%A1%E5%87%BA%E6%BB%A1%E8%B6%B3%E9%99%A4%E4%BD%BF%E7%94%A8%E5%88%B0%E5%AF%B9%E5%BA%94%E7%B4%A2%E5%BC%95%E7%9A%84%E6%90%9C%E7%B4%A2%E6%9D%A1%E4%BB%B6%E5%A4%96%E7%9A%84%E5%85%B6%E4%BB%96%E6%90%9C%E7%B4%A2%E6%9D%A1%E4%BB%B6%E7%9A%84%E8%AE%B0%E5%BD%95%E6%9C%89%E5%A4%9A%E5%B0%91%E6%9D%A1%E3%80%82%0A%0A!%5B3c80ccb02d44b5e945e6b6d65c778897.png%5D(en-resource%3A%2F%2Fdatabase%2F906%3A1)%0A%0A%E4%BB%8E%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E7%9A%84key%E5%88%97%E4%B8%AD%E5%8F%AF%E4%BB%A5%E7%9C%8B%E5%87%BA%E6%9D%A5%EF%BC%8C%E8%AF%A5%E6%9F%A5%E8%AF%A2%E4%BD%BF%E7%94%A8idx_key1%E7%B4%A2%E5%BC%95%E6%9D%A5%E6%89%A7%E8%A1%8C%E6%9F%A5%E8%AF%A2%EF%BC%8C%E4%BB%8Erows%E5%88%97%E5%8F%AF%E4%BB%A5%E7%9C%8B%E5%87%BA%E6%BB%A1%E8%B6%B3key1%20%3E%20'z'%E7%9A%84%E8%AE%B0%E5%BD%95%E6%9C%89266%E6%9D%A1%E3%80%82%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E7%9A%84filtered%E5%88%97%E5%B0%B1%E4%BB%A3%E8%A1%A8%E6%9F%A5%E8%AF%A2%E4%BC%98%E5%8C%96%E5%99%A8%E9%A2%84%E6%B5%8B%E5%9C%A8%E8%BF%99266%E6%9D%A1%E8%AE%B0%E5%BD%95%E4%B8%AD%EF%BC%8C%E6%9C%89%E5%A4%9A%E5%B0%91%E6%9D%A1%E8%AE%B0%E5%BD%95%E6%BB%A1%E8%B6%B3%E5%85%B6%E4%BD%99%E7%9A%84%E6%90%9C%E7%B4%A2%E6%9D%A1%E4%BB%B6%EF%BC%8C%E4%B9%9F%E5%B0%B1%E6%98%AFcommon_field%20%3D%20'a'%E8%BF%99%E4%B8%AA%E6%9D%A1%E4%BB%B6%E7%9A%84%E7%99%BE%E5%88%86%E6%AF%94%E3%80%82%E6%AD%A4%E5%A4%84filtered%E5%88%97%E7%9A%84%E5%80%BC%E6%98%AF10.00%EF%BC%8C%E8%AF%B4%E6%98%8E%E6%9F%A5%E8%AF%A2%E4%BC%98%E5%8C%96%E5%99%A8%E9%A2%84%E6%B5%8B%E5%9C%A8266%E6%9D%A1%E8%AE%B0%E5%BD%95%E4%B8%AD%E6%9C%8910.00%25%E7%9A%84%E8%AE%B0%E5%BD%95%E6%BB%A1%E8%B6%B3common_field%20%3D%20'a'%E8%BF%99%E4%B8%AA%E6%9D%A1%E4%BB%B6%E3%80%82%0A%E5%AF%B9%E4%BA%8E%E5%8D%95%E8%A1%A8%E6%9F%A5%E8%AF%A2%E6%9D%A5%E8%AF%B4%EF%BC%8C%E8%BF%99%E4%B8%AAfiltered%E5%88%97%E7%9A%84%E5%80%BC%E6%B2%A1%E4%BB%80%E4%B9%88%E6%84%8F%E4%B9%89%EF%BC%8C%E6%88%91%E4%BB%AC%E6%9B%B4%E5%85%B3%E6%B3%A8%E5%9C%A8%E8%BF%9E%E6%8E%A5%E6%9F%A5%E8%AF%A2%E4%B8%AD%E9%A9%B1%E5%8A%A8%E8%A1%A8%E5%AF%B9%E5%BA%94%E7%9A%84%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E8%AE%B0%E5%BD%95%E7%9A%84filtered%E5%80%BC%EF%BC%8C%E6%AF%94%E6%96%B9%E8%AF%B4%E4%B8%8B%E8%BE%B9%E8%BF%99%E4%B8%AA%E6%9F%A5%E8%AF%A2%EF%BC%9A!%5B7042d194f8b48c1815e0977331ce3079.png%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BC%E6%9D%A5%E6%9B%B4%E5%87%86%E7%A1%AE%E7%9A%84%E7%90%86%E8%A7%A3MySQL%E5%88%97%E5%B0%86%E5%A6%82%E4%BD%95%E6%89%A7%E8%A1%8C%E7%BB%99%E5%AE%9A%E7%9A%84%E6%9F%A5%E8%AF%A2%E8%AF%AD%E5%8F%A5%EF%BC%8C%E8%BF%99%E9%87%8C%E6%8C%91%E4%B8%80%E4%BA%9B%E5%B9%B3%E6%97%B6%E5%B8%B8%E8%A7%81%E7%9A%84%E6%88%96%E8%80%85%E6%AF%94%E8%BE%83%E9%87%8D%E8%A6%81%E7%9A%84%E3%80%82%0A%0A*%20**No%20tables%20used**%0A%E5%BD%93%E6%9F%A5%E8%AF%A2%E8%AF%AD%E5%8F%A5%E7%9A%84%E6%B2%A1%E6%9C%89FROM%E5%AD%90%E5%8F%A5%E6%97%B6%E5%B0%86%E4%BC%9A%E6%8F%90%E7%A4%BA%E8%AF%A5%E9%A2%9D%E5%A4%96%E4%BF%A1%E6%81%AF%EF%BC%8C%E6%AF%94%E5%A6%82%EF%BC%9A%0AEXPLAIN%20SELECT%201%EF%BC%9B!%5B94977de098535441a68e5390a6b597c5.png%5D(en-resource%3A%2F%2Fdatabase%2F910%3A1)%0A%0A*%20**Impossible%20WHERE**%0A%E6%9F%A5%E8%AF%A2%E8%AF%AD%E5%8F%A5%E7%9A%84WHERE%E5%AD%90%E5%8F%A5%E6%B0%B8%E8%BF%9C%E4%B8%BAFALSE%E6%97%B6%E5%B0%86%E4%BC%9A%E6%8F%90%E7%A4%BA%E8%AF%A5%E9%A2%9D%E5%A4%96%E4%BF%A1%E6%81%AF%EF%BC%8C%E6%AF%94%E6%96%B9%E8%AF%B4%EF%BC%9A%0AEXPLAIN%20SELECT%20*%20FROM%20s1%20WHERE%201%20!%3D%201%EF%BC%9B%0A%0A*%20**No%20matching%20min%2Fmax%20row**%0A%E5%BD%93%E6%9F%A5%E8%AF%A2%E5%88%97%E8%A1%A8%E5%A4%84%E6%9C%89MIN%E6%88%96%E8%80%85MAX%E8%81%9A%E9%9B%86%E5%87%BD%E6%95%B0%EF%BC%8C%E4%BD%86%E6%98%AF%E5%B9%B6%E6%B2%A1%E6%9C%89%E7%AC%A6%E5%90%88WHERE%E5%AD%90%E5%8F%A5%E4%B8%AD%E7%9A%84%E6%90%9C%E7%B4%A2%E6%9D%A1%E4%BB%B6%E7%9A%84%E8%AE%B0%E5%BD%95%E6%97%B6%EF%BC%8C%E5%B0%86%E4%BC%9A%E6%8F%90%E7%A4%BA%E8%AF%A5%E9%A2%9D%E5%A4%96%E4%BF%A1%E6%81%AF%EF%BC%8C%E6%AF%94%E6%96%B9%E8%AF%B4%EF%BC%9A%0AXPLAIN%20SELECT%20MIN(key1)%20FROM%20s1%20WHERE%20key1%20%3D%20'abcdefg'%EF%BC%9B!%5B1ae1a88dfce9bb083b80b36962140016.png%5D(en-resource%3A%2F%2Fdatabase%2F912%3A1)%0A%0A*%20**Using%20index**%0A%E5%BD%93%E6%88%91%E4%BB%AC%E7%9A%84%E6%9F%A5%E8%AF%A2%E5%88%97%E8%A1%A8%E4%BB%A5%E5%8F%8A%E6%90%9C%E7%B4%A2%E6%9D%A1%E4%BB%B6%E4%B8%AD%E5%8F%AA%E5%8C%85%E5%90%AB%E5%B1%9E%E4%BA%8E%E6%9F%90%E4%B8%AA%E7%B4%A2%E5%BC%95%E7%9A%84%E5%88%97%EF%BC%8C%E4%B9%9F%E5%B0%B1%E6%98%AF%E5%9C%A8%E5%8F%AF%E4%BB%A5%E4%BD%BF%E7%94%A8%E7%B4%A2%E5%BC%95%E8%A6%86%E7%9B%96%E7%9A%84%E6%83%85%E5%86%B5%E4%B8%8B%EF%BC%8C%E5%9C%A8Extra%E5%88%97%E5%B0%86%E4%BC%9A%E6%8F%90%E7%A4%BA%E8%AF%A5%E9%A2%9D%E5%A4%96%E4%BF%A1%E6%81%AF%E3%80%82%E6%AF%94%E6%96%B9%E8%AF%B4%E4%B8%8B%E8%BE%B9%E8%BF%99%E4%B8%AA%E6%9F%A5%E8%AF%A2%E4%B8%AD%E5%8F%AA%E9%9C%80%E8%A6%81%E7%94%A8%E5%88%B0idx_key1%E8%80%8C%E4%B8%8D%E9%9C%80%E8%A6%81%E5%9B%9E%E8%A1%A8%E6%93%8D%E4%BD%9C%EF%BC%9A%0A%0A*%20**Using%20index%20condition**%0A%E6%9C%89%E4%BA%9B%E6%90%9C%E7%B4%A2%E6%9D%A1%E4%BB%B6%E4%B8%AD%E8%99%BD%E7%84%B6%E5%87%BA%E7%8E%B0%E4%BA%86%E7%B4%A2%E5%BC%95%E5%88%97%EF%BC%8C%E4%BD%86%E5%8D%B4%E4%B8%8D%E8%83%BD%E4%BD%BF%E7%94%A8%E5%88%B0%E7%B4%A2%E5%BC%95%EF%BC%8C%E6%AF%94%E5%A6%82%E4%B8%8B%E8%BE%B9%E8%BF%99%E4%B8%AA%E6%9F%A5%E8%AF%A2%EF%BC%9A%0ASELECT%20*%20FROM%20s1%20WHERE%20key1%20%3E%20'z'%20AND%20key1%20LIKE%20'%25a'%EF%BC%9B%0A%E5%85%B6%E4%B8%AD%E7%9A%84key1%20%3E%20'z'%E5%8F%AF%E4%BB%A5%E4%BD%BF%E7%94%A8%E5%88%B0%E7%B4%A2%E5%BC%95%EF%BC%8C%E4%BD%86%E6%98%AFkey1%20LIKE%20'%25a'%E5%8D%B4%E6%97%A0%E6%B3%95%E4%BD%BF%E7%94%A8%E5%88%B0%E7%B4%A2%E5%BC%95%EF%BC%9B%0Aa.%20%E5%85%88%E6%A0%B9%E6%8D%AEkey1%20%3E%20'z'%E8%BF%99%E4%B8%AA%E6%9D%A1%E4%BB%B6%EF%BC%8C%E5%AE%9A%E4%BD%8D%E5%88%B0%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95idx_key1%E4%B8%AD%E5%AF%B9%E5%BA%94%E7%9A%84%E4%BA%8C%E7%BA%A7%E7%B4%A2%E5%BC%95%E8%AE%B0%E5%BD%95%EF%BC%9B%0Ab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D%E7%84%B6%E5%8F%AA%E6%94%B9%E8%BF%9B%E4%BA%86%E4%B8%80%E7%82%B9%E7%82%B9%EF%BC%8C%E4%BD%86%E6%98%AF%E5%8F%AF%E4%BB%A5%E7%9C%81%E5%8E%BB%E5%A5%BD%E5%A4%9A%E5%9B%9E%E8%A1%A8%E6%93%8D%E4%BD%9C%E7%9A%84%E6%88%90%E6%9C%AC%E3%80%82%E8%AE%BE%E8%AE%A1MySQL%E7%9A%84%E5%A4%A7%E5%8F%94%E4%BB%AC%E6%8A%8A%E4%BB%96%E4%BB%AC%E7%9A%84%E8%BF%99%E4%B8%AA%E6%94%B9%E8%BF%9B%E7%A7%B0%E4%B9%8B%E4%B8%BA**%E7%B4%A2%E5%BC%95%E6%9D%A1%E4%BB%B6%E4%B8%8B%E6%8E%A8%EF%BC%88%E8%8B%B1%E6%96%87%E5%90%8D%EF%BC%9AIndex%20Condition%20Pushdown%EF%BC%89**%E3%80%82%0A**%E5%A6%82%E6%9E%9C%E5%9C%A8%E6%9F%A5%E8%AF%A2%E8%AF%AD%E5%8F%A5%E7%9A%84%E6%89%A7%E8%A1%8C%E8%BF%87%E7%A8%8B%E4%B8%AD%E5%B0%86%E8%A6%81%E4%BD%BF%E7%94%A8%E7%B4%A2%E5%BC%95%E6%9D%A1%E4%BB%B6%E4%B8%8B%E6%8E%A8%E8%BF%99%E4%B8%AA%E7%89%B9%E6%80%A7%EF%BC%8C%E5%9C%A8Extra%E5%88%97%E4%B8%AD%E5%B0%86%E4%BC%9A%E6%98%BE%E7%A4%BAUsing%20index%20condition**%EF%BC%8C%E6%AF%94%E5%A6%82%E8%BF%99%E6%A0%B7%EF%BC%9A!%5B87c2756cb1278e6eb5f5681495ea11a5.png%5D(en-resource%3A%2F%2Fdatabase%2F914%3A1)%0A%0A*%20**Using%20where**%0A%E5%BD%93%E6%88%91%E4%BB%AC%E4%BD%BF%E7%94%A8%E5%85%A8%E8%A1%A8%E6%89%AB%E6%8F%8F%E6%9D%A5%E6%89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9F%E4%BC%9A%E6%8F%90%E7%A4%BA%E4%B8%8A%E8%BF%B0%E9%A2%9D%E5%A4%96%E4%BF%A1%E6%81%AF%E3%80%82%E6%AF%94%E5%A6%82%E4%B8%8B%E8%BE%B9%E8%BF%99%E4%B8%AA%E6%9F%A5%E8%AF%A2%E8%99%BD%E7%84%B6%E4%BD%BF%E7%94%A8idx_key1%E7%B4%A2%E5%BC%95%E6%89%A7%E8%A1%8C%E6%9F%A5%E8%AF%A2%EF%BC%8C%E4%BD%86%E6%98%AF%E6%90%9C%E7%B4%A2%E6%9D%A1%E4%BB%B6%E4%B8%AD%E9%99%A4%E4%BA%86%E5%8C%85%E5%90%ABkey1%E7%9A%84%E6%90%9C%E7%B4%A2%E6%9D%A1%E4%BB%B6key1%20%3D%20'a'%EF%BC%8C%E8%BF%98%E6%9C%89%E5%8C%85%E5%90%ABcommon_field%E7%9A%84%E6%90%9C%E7%B4%A2%E6%9D%A1%E4%BB%B6%EF%BC%8C%E6%89%80%E4%BB%A5Extra%E5%88%97%E4%BC%9A%E6%98%BE%E7%A4%BAUsing%20where%E7%9A%84%E6%8F%90%E7%A4%BA%EF%BC%9A%0AEXPLAIN%20SELECT%20*%20FROM%20s1%20WHERE%20key1%20%3D%20'a'%20AND%20common_field%20%3D%20'a'%3B%0A%0A*%20**Using%20join%20buffer%20(Block%20Nested%20Loop)**%0A%E5%9C%A8%E8%BF%9E%E6%8E%A5%E6%9F%A5%E8%AF%A2%E6%89%A7%E8%A1%8C%E8%BF%87%E7%A8%8B%E4%B8%AD%EF%BC%8C%E5%BD%93%E8%A2%AB%E9%A9%B1%E5%8A%A8%E8%A1%A8%E4%B8%8D%E8%83%BD%E6%9C%89%E6%95%88%E7%9A%84%E5%88%A9%E7%94%A8%E7%B4%A2%E5%BC%95%E5%8A%A0%E5%BF%AB%E8%AE%BF%E9%97%AE%E9%80%9F%E5%BA%A6%EF%BC%8CMySQL%E4%B8%80%E8%88%AC%E4%BC%9A%E4%B8%BA%E5%85%B6%E5%88%86%E9%85%8D%E4%B8%80%E5%9D%97%E5%90%8D%E5%8F%ABjoin%20buffer%E7%9A%84%E5%86%85%E5%AD%98%E5%9D%97%E6%9D%A5%E5%8A%A0%E5%BF%AB%E6%9F%A5%E8%AF%A2%E9%80%9F%E5%BA%A6%EF%BC%8C%E4%B9%9F%E5%B0%B1%E6%98%AF%E6%88%91%E4%BB%AC%E6%89%80%E8%AE%B2%E7%9A%84%E5%9F%BA%E4%BA%8E%E5%9D%97%E7%9A%84%E5%B5%8C%E5%A5%97%E5%BE%AA%E7%8E%AF%E7%AE%97%E6%B3%95%EF%BC%8C%E6%AF%94%E5%A6%82%E4%B8%8B%E8%BE%B9%E8%BF%99%E4%B8%AA%E6%9F%A5%E8%AF%A2%E8%AF%AD%E5%8F%A5%EF%BC%9A%0AEXPLAIN%20SELECT%20*%20FROM%20s1%20INNER%20JOIN%20s2%20ON%20s1.common_field%20%3D%20s2.common_field%EF%BC%9B!%5B691b4f804066b7ffda7596bd801944aa.png%5D(en-resource%3A%2F%2Fdatabase%2F918%3A0)%0A%E5%8F%AF%E4%BB%A5%E5%9C%A8%E5%AF%B9s2%E8%A1%A8%E7%9A%84%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E7%9A%84Extra%E5%88%97%E6%98%BE%E7%A4%BA%E4%BA%86%E4%B8%A4%E4%B8%AA%E6%8F%90%E7%A4%BA%EF%BC%9A%0Aa.%20**Using%20join%20buffer%20(Block%20Nested%20Loop)%EF%BC%9A**%E8%BF%99%E6%98%AF%E5%9B%A0%E4%B8%BA%E5%AF%B9%E8%A1%A8s2%E7%9A%84%E8%AE%BF%E9%97%AE%E4%B8%8D%E8%83%BD%E6%9C%89%E6%95%88%E5%88%A9%E7%94%A8%E7%B4%A2%E5%BC%95%EF%BC%8C%E5%8F%AA%E5%A5%BD%E9%80%80%E8%80%8C%E6%B1%82%E5%85%B6%E6%AC%A1%EF%BC%8C%E4%BD%BF%E7%94%A8join%20buffer%E6%9D%A5%E5%87%8F%E5%B0%91%E5%AF%B9s2%E8%A1%A8%E7%9A%84%E8%AE%BF%E9%97%AE%E6%AC%A1%E6%95%B0%EF%BC%8C%E4%BB%8E%E8%80%8C%E6%8F%90%E9%AB%98%E6%80%A7%E8%83%BD%EF%BC%9B%0Ab.%20**Using%20where%EF%BC%9A**%E5%8F%AF%E4%BB%A5%E7%9C%8B%E5%88%B0%E6%9F%A5%E8%AF%A2%E8%AF%AD%E5%8F%A5%E4%B8%AD%E6%9C%89%E4%B8%80%E4%B8%AAs1.common_field%20%3D%20s2.common_field%E6%9D%A1%E4%BB%B6%EF%BC%8C%E5%9B%A0%E4%B8%BAs1%E6%98%AF%E9%A9%B1%E5%8A%A8%E8%A1%A8%EF%BC%8Cs2%E6%98%AF%E8%A2%AB%E9%A9%B1%E5%8A%A8%E8%A1%A8%EF%BC%8C%E6%89%80%E4%BB%A5%E5%9C%A8%E8%AE%BF%E9%97%AEs2%E8%A1%A8%E6%97%B6%EF%BC%8Cs1.common_field%E7%9A%84%E5%80%BC%E5%B7%B2%E7%BB%8F%E7%A1%AE%E5%AE%9A%E4%B8%8B%E6%9D%A5%E4%BA%86%EF%BC%8C%E6%89%80%E4%BB%A5%E5%AE%9E%E9%99%85%E4%B8%8A%E6%9F%A5%E8%AF%A2s2%E8%A1%A8%E7%9A%84%E6%9D%A1%E4%BB%B6%E5%B0%B1%E6%98%AFs2.common_field%20%3D%20%E4%B8%80%E4%B8%AA%E5%B8%B8%E6%95%B0%EF%BC%8C%E6%89%80%E4%BB%A5%E6%8F%90%E7%A4%BA%E4%BA%86Using%20where%E9%A2%9D%E5%A4%96%E4%BF%A1%E6%81%AF.%0A%0A%0A*%20**Not%20exists**%0A%E5%BD%93%E6%88%91%E4%BB%AC%E4%BD%BF%E7%94%A8%E5%B7%A6%EF%BC%88%E5%A4%96%EF%BC%89%E8%BF%9E%E6%8E%A5%E6%97%B6%EF%BC%8C%E5%A6%82%E6%9E%9CWHERE%E5%AD%90%E5%8F%A5%E4%B8%AD%E5%8C%85%E5%90%AB%E8%A6%81%E6%B1%82%E8%A2%AB%E9%A9%B1%E5%8A%A8%E8%A1%A8%E7%9A%84%E6%9F%90%E4%B8%AA%E5%88%97%E7%AD%89%E4%BA%8ENULL%E5%80%BC%E7%9A%84%E6%90%9C%E7%B4%A2%E6%9D%A1%E4%BB%B6%EF%BC%8C%E8%80%8C%E4%B8%94%E9%82%A3%E4%B8%AA%E5%88%97%E5%8F%88%E6%98%AF%E4%B8%8D%E5%85%81%E8%AE%B8%E5%AD%98%E5%82%A8NULL%E5%80%BC%E7%9A%84%EF%BC%8C%E9%82%A3%E4%B9%88%E5%9C%A8%E8%AF%A5%E8%A1%A8%E7%9A%84%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E7%9A%84Extra%E5%88%97%E5%B0%B1%E4%BC%9A%E6%8F%90%E7%A4%BANot%20exists%E9%A2%9D%E5%A4%96%E4%BF%A1%E6%81%AF%EF%BC%8C%E6%AF%94%E5%A6%82%E8%BF%99%E6%A0%B7%EF%BC%9A!%5Bfa5bd3954312849b1e3179c886cf2473.png%5D(en-resource%3A%2F%2Fdatabase%2F920%3A0)%0A%E4%B8%8A%E8%BF%B0%E6%9F%A5%E8%AF%A2%E4%B8%ADs1%E8%A1%A8%E6%98%AF%E9%A9%B1%E5%8A%A8%E8%A1%A8%EF%BC%8Cs2%E8%A1%A8%E6%98%AF%E8%A2%AB%E9%A9%B1%E5%8A%A8%E8%A1%A8%EF%BC%8Cs2.id%E5%88%97%E6%98%AF%E4%B8%8D%E5%85%81%E8%AE%B8%E5%AD%98%E5%82%A8NULL%E5%80%BC%E7%9A%84%EF%BC%8C%E8%80%8CWHERE%E5%AD%90%E5%8F%A5%E4%B8%AD%E5%8F%88%E5%8C%85%E5%90%ABs2.id%20IS%20NULL%E7%9A%84%E6%90%9C%E7%B4%A2%E6%9D%A1%E4%BB%B6%EF%BC%8C%E8%BF%99%E6%84%8F%E5%91%B3%E7%9D%80%E5%BF%85%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E9%A9%B1%E5%8A%A8%E8%A1%A8%E4%B8%AD%E6%89%BE%E5%88%B0%E5%85%A8%E9%83%A8%E7%AC%A6%E5%90%88ON%E5%AD%90%E5%8F%A5%E6%9D%A1%E4%BB%B6%E7%9A%84%E8%AE%B0%E5%BD%95**%EF%BC%8C%E8%BF%99%E6%A0%B7%E5%8F%AF%E4%BB%A5%E7%A8%8D%E5%BE%AE%E8%8A%82%E7%9C%81%E4%B8%80%E7%82%B9%E6%80%A7%E8%83%BD%E3%80%82%0A%0A%0A*%20**Using%20intersect(...)%E3%80%81Using%20union(...)%E5%92%8CUsing%20sort_union(...)**%0A%E5%A6%82%E6%9E%9C%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E7%9A%84Extra%E5%88%97%E5%87%BA%E7%8E%B0%E4%BA%86Using%20intersect(...)%E6%8F%90%E7%A4%BA%EF%BC%8C%E8%AF%B4%E6%98%8E%E5%87%86%E5%A4%87%E4%BD%BF%E7%94%A8Intersect%E7%B4%A2%E5%BC%95%E5%90%88%E5%B9%B6%E7%9A%84%E6%96%B9%E5%BC%8F%E6%89%A7%E8%A1%8C%E6%9F%A5%E8%AF%A2%EF%BC%8C%E6%8B%AC%E5%8F%B7%E4%B8%AD%E7%9A%84...%E8%A1%A8%E7%A4%BA%E9%9C%80%E8%A6%81%E8%BF%9B%E8%A1%8C%E7%B4%A2%E5%BC%95%E5%90%88%E5%B9%B6%E7%9A%84%E7%B4%A2%E5%BC%95%E5%90%8D%E7%A7%B0%EF%BC%9B%E5%A6%82%E6%9E%9C%E5%87%BA%E7%8E%B0%E4%BA%86Using%20union(...)%E6%8F%90%E7%A4%BA%EF%BC%8C%E8%AF%B4%E6%98%8E%E5%87%86%E5%A4%87%E4%BD%BF%E7%94%A8Union%E7%B4%A2%E5%BC%95%E5%90%88%E5%B9%B6%E7%9A%84%E6%96%B9%E5%BC%8F%E6%89%A7%E8%A1%8C%E6%9F%A5%E8%AF%A2%EF%BC%9B%E5%87%BA%E7%8E%B0%E4%BA%86Using%20sort_union(...)%E6%8F%90%E7%A4%BA%EF%BC%8C%E8%AF%B4%E6%98%8E%E5%87%86%E5%A4%87%E4%BD%BF%E7%94%A8Sort-Union%E7%B4%A2%E5%BC%95%E5%90%88%E5%B9%B6%E7%9A%84%E6%96%B9%E5%BC%8F%E6%89%A7%E8%A1%8C%E6%9F%A5%E8%AF%A2%E3%80%82%E6%AF%94%E5%A6%82%E8%BF%99%E4%B8%AA%E6%9F%A5%E8%AF%A2%E7%9A%84%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%EF%BC%9A%0AEXPLAIN%20SELECT%20*%20FROM%20s1%20WHERE%20key1%20%3D%20'a'%20AND%20key3%20%3D%20'a'%EF%BC%9B!%5Bad4652a511da249e494b4842381865fd.png%5D(en-resource%3A%2F%2Fdatabase%2F922%3A0)%0A%E5%85%B6%E4%B8%ADExtra%E5%88%97%E5%B0%B1%E6%98%BE%E7%A4%BA%E4%BA%86Using%20intersect(idx_key3%2Cidx_key1)%EF%BC%8C%E8%A1%A8%E6%98%8EMySQL%E5%8D%B3%E5%B0%86%E4%BD%BF%E7%94%A8idx_key3%E5%92%8Cidx_key1%E8%BF%99%E4%B8%A4%E4%B8%AA%E7%B4%A2%E5%BC%95%E8%BF%9B%E8%A1%8CIntersect%E7%B4%A2%E5%BC%95%E5%90%88%E5%B9%B6%E7%9A%84%E6%96%B9%E5%BC%8F%E6%89%A7%E8%A1%8C%E6%9F%A5%E8%AF%A2%E3%80%82%0A%0A*%20**Zero%20limit**%0A%E5%BD%93%E6%88%91%E4%BB%AC%E7%9A%84LIMIT%E5%AD%90%E5%8F%A5%E7%9A%84%E5%8F%82%E6%95%B0%E4%B8%BA0%E6%97%B6%EF%BC%8C%E8%A1%A8%E7%A4%BA%E5%8E%8B%E6%A0%B9%E5%84%BF%E4%B8%8D%E6%89%93%E7%AE%97%E4%BB%8E%E8%A1%A8%E4%B8%AD%E8%AF%BB%E5%87%BA%E4%BB%BB%E4%BD%95%E8%AE%B0%E5%BD%95%EF%BC%8C%E5%B0%86%E4%BC%9A%E6%8F%90%E7%A4%BA%E8%AF%A5%E9%A2%9D%E5%A4%96%E4%BF%A1%E6%81%AF%EF%BC%8C%E6%AF%94%E5%A6%82%E8%BF%99%E6%A0%B7%EF%BC%9A%0AEXPLAIN%20SELECT%20*%20FROM%20s1%20LIMIT%200%EF%BC%9B%0A%0A*%20**Using%20filesort**%0A%E5%BE%88%E5%A4%9A%E6%83%85%E5%86%B5%E4%B8%8B%E6%8E%92%E5%BA%8F%E6%93%8D%E4%BD%9C%E6%97%A0%E6%B3%95%E4%BD%BF%E7%94%A8%E5%88%B0%E7%B4%A2%E5%BC%95%EF%BC%8C%E5%8F%AA%E8%83%BD%E5%9C%A8%E5%86%85%E5%AD%98%E4%B8%AD%EF%BC%88%E8%AE%B0%E5%BD%95%E8%BE%83%E5%B0%91%E7%9A%84%E6%97%B6%E5%80%99%EF%BC%89%E6%88%96%E8%80%85%E7%A3%81%E7%9B%98%E4%B8%AD%EF%BC%88%E8%AE%B0%E5%BD%95%E8%BE%83%E5%A4%9A%E7%9A%84%E6%97%B6%E5%80%99%EF%BC%89%E8%BF%9B%E8%A1%8C%E6%8E%92%E5%BA%8F%EF%BC%8CMySQL%E6%8A%8A%E8%BF%99%E7%A7%8D%E5%9C%A8%E5%86%85%E5%AD%98%E4%B8%AD%E6%88%96%E8%80%85%E7%A3%81%E7%9B%98%E4%B8%8A%E8%BF%9B%E8%A1%8C%E6%8E%92%E5%BA%8F%E7%9A%84%E6%96%B9%E5%BC%8F%E7%BB%9F%E7%A7%B0%E4%B8%BA**%E6%96%87%E4%BB%B6%E6%8E%92%E5%BA%8F%EF%BC%88%E8%8B%B1%E6%96%87%E5%90%8D%EF%BC%9Afilesort%EF%BC%89**%E3%80%82%E5%A6%82%E6%9E%9C%E6%9F%90%E4%B8%AA%E6%9F%A5%E8%AF%A2%E9%9C%80%E8%A6%81%E4%BD%BF%E7%94%A8%E6%96%87%E4%BB%B6%E6%8E%92%E5%BA%8F%E7%9A%84%E6%96%B9%E5%BC%8F%E6%89%A7%E8%A1%8C%E6%9F%A5%E8%AF%A2%EF%BC%8C%E5%B0%B1%E4%BC%9A%E5%9C%A8%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E7%9A%84Extra%E5%88%97%E4%B8%AD%E6%98%BE%E7%A4%BAUsing%20filesort%E6%8F%90%E7%A4%BA%EF%BC%8C%E6%AF%94%E5%A6%82%E8%BF%99%E6%A0%B7%EF%BC%9AEXPLAIN%20SELECT%20*%20FROM%20s1%20ORDER%20BY%20common_field%20LIMIT%2010%EF%BC%9B%0A%E9%9C%80%E8%A6%81%E6%B3%A8%E6%84%8F%E7%9A%84%E6%98%AF%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%9F%A5%E8%AF%A2%E4%B8%AD%E9%9C%80%E8%A6%81%E4%BD%BF%E7%94%A8filesort%E7%9A%84%E6%96%B9%E5%BC%8F%E8%BF%9B%E8%A1%8C%E6%8E%92%E5%BA%8F%E7%9A%84%E8%AE%B0%E5%BD%95%E9%9D%9E%E5%B8%B8%E5%A4%9A%EF%BC%8C%E9%82%A3%E4%B9%88%E8%BF%99%E4%B8%AA%E8%BF%87%E7%A8%8B%E6%98%AF%E5%BE%88%E8%80%97%E8%B4%B9%E6%80%A7%E8%83%BD%E7%9A%84%EF%BC%8C%E6%9C%80%E5%A5%BD%E6%83%B3%E5%8A%9E%E6%B3%95%E5%B0%86%E4%BD%BF%E7%94%A8%E6%96%87%E4%BB%B6%E6%8E%92%E5%BA%8F%E7%9A%84%E6%89%A7%E8%A1%8C%E6%96%B9%E5%BC%8F%E6%94%B9%E4%B8%BA%E4%BD%BF%E7%94%A8%E7%B4%A2%E5%BC%95%E8%BF%9B%E8%A1%8C%E6%8E%92%E5%BA%8F%E3%80%82%0A%0A*%20**Using%20temporary**%0A%E5%9C%A8%E8%AE%B8%E5%A4%9A%E6%9F%A5%E8%AF%A2%E7%9A%84%E6%89%A7%E8%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%E7%A4%BAUsing%20temporary%E6%8F%90%E7%A4%BA%EF%BC%8C%E6%AF%94%E6%96%B9%E8%AF%B4%E8%BF%99%E6%A0%B7%EF%BC%9A%0AEXPLAIN%20SELECT%20DISTINCT%20common_field%20FROM%20s1%EF%BC%9B!%5Bd6a7ee343a055a0484e79462394e6cef.png%5D(en-resource%3A%2F%2Fdatabase%2F924%3A0)%0A%E4%B8%8A%E8%BF%B0%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E7%9A%84Extra%E5%88%97%E4%B8%8D%E4%BB%85%E4%BB%85%E5%8C%85%E5%90%ABUsing%20temporary%E6%8F%90%E7%A4%BA%EF%BC%8C%E8%BF%98%E5%8C%85%E5%90%ABUsing%20filesort%E6%8F%90%E7%A4%BA%EF%BC%8C%E5%8F%AF%E6%98%AF%E6%88%91%E4%BB%AC%E7%9A%84%E6%9F%A5%E8%AF%A2%E8%AF%AD%E5%8F%A5%E4%B8%AD%E6%98%8E%E6%98%8E%E6%B2%A1%E6%9C%89%E5%86%99ORDER%20BY%E5%AD%90%E5%8F%A5%E5%91%80%EF%BC%9F%E8%BF%99%E6%98%AF%E5%9B%A0%E4%B8%BA**MySQL%E4%BC%9A%E5%9C%A8%E5%8C%85%E5%90%ABGROUP%20BY%E5%AD%90%E5%8F%A5%E7%9A%84%E6%9F%A5%E8%AF%A2%E4%B8%AD%E9%BB%98%E8%AE%A4%E6%B7%BB%E5%8A%A0%E4%B8%8AORDER%20BY%E5%AD%90%E5%8F%A5**%EF%BC%8C%E4%B9%9F%E5%B0%B1%E6%98%AF%E8%AF%B4%E4%B8%8A%E8%BF%B0%E6%9F%A5%E8%AF%A2%E5%85%B6%E5%AE%9E%E5%92%8C%E4%B8%8B%E8%BE%B9%E8%BF%99%E4%B8%AA%E6%9F%A5%E8%AF%A2%E7%AD%89%E4%BB%B7%EF%BC%9A%0AEXPLAIN%20SELECT%20common_field%2C%20COUNT(*)%20AS%20amount%20FROM%20s1%20GROUP%20BY%20common_field%20ORDER%20BY%20common_field%EF%BC%9B%0A%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E5%B9%B6%E4%B8%8D%E6%83%B3%E4%B8%BA%E5%8C%85%E5%90%ABGROUP%20BY%E5%AD%90%E5%8F%A5%E7%9A%84%E6%9F%A5%E8%AF%A2%E8%BF%9B%E8%A1%8C%E6%8E%92%E5%BA%8F%EF%BC%8C%E9%9C%80%E8%A6%81%E6%88%91%E4%BB%AC%E6%98%BE%E5%BC%8F%E7%9A%84%E5%86%99%E4%B8%8AORDER%20BY%20NULL%EF%BC%8C%E5%B0%B1%E5%83%8F%E8%BF%99%E6%A0%B7%EF%BC%9A%0AEXPLAIN%20SELECT%20common_field%2C%20COUNT(*)%20AS%20amount%20FROM%20s1%20GROUP%20BY%20common_field%20ORDER%20BY%20NULL%EF%BC%9B%0A%E5%8F%A6%E5%A4%96%EF%BC%8C%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E4%B8%AD%E5%87%BA%E7%8E%B0Using%20temporary%E5%B9%B6%E4%B8%8D%E6%98%AF%E4%B8%80%E4%B8%AA%E5%A5%BD%E7%9A%84%E5%BE%81%E5%85%86%EF%BC%8C%E5%9B%A0%E4%B8%BA%E5%BB%BA%E7%AB%8B%E4%B8%8E%E7%BB%B4%E6%8A%A4%E4%B8%B4%E6%97%B6%E8%A1%A8%E8%A6%81%E4%BB%98%E5%87%BA%E5%BE%88%E5%A4%A7%E6%88%90%E6%9C%AC%E7%9A%84%EF%BC%8C%E6%89%80%E4%BB%A5%E6%88%91%E4%BB%AC%E6%9C%80%E5%A5%BD%E8%83%BD%E4%BD%BF%E7%94%A8%E7%B4%A2%E5%BC%95%E6%9D%A5%E6%9B%BF%E4%BB%A3%E6%8E%89%E4%BD%BF%E7%94%A8%E4%B8%B4%E6%97%B6%E8%A1%A8%EF%BC%8C%E6%AF%94%E6%96%B9%E8%AF%B4%E4%B8%8B%E8%BE%B9%E8%BF%99%E4%B8%AA%E5%8C%85%E5%90%ABGROUP%20BY%E5%AD%90%E5%8F%A5%E7%9A%84%E6%9F%A5%E8%AF%A2%E5%B0%B1%E4%B8%8D%E9%9C%80%E8%A6%81%E4%BD%BF%E7%94%A8%E4%B8%B4%E6%97%B6%E8%A1%A8%EF%BC%9A%0AEXPLAIN%20SELECT%20key1%2C%20COUNT(*)%20AS%20amount%20FROM%20s1%20GROUP%20BY%20key1%EF%BC%9B%0A%0A*%20**Start%20temporary%2C%20End%20temporary**%0A%E6%9F%A5%E8%AF%A2%E4%BC%98%E5%8C%96%E5%99%A8%E4%BC%9A%E4%BC%98%E5%85%88%E5%B0%9D%E8%AF%95%E5%B0%86IN%E5%AD%90%E6%9F%A5%E8%AF%A2%E8%BD%AC%E6%8D%A2%E6%88%90semi-join%EF%BC%8C%E8%80%8Csemi-join%E5%8F%88%E6%9C%89%E5%A5%BD%E5%A4%9A%E7%A7%8D%E6%89%A7%E8%A1%8C%E7%AD%96%E7%95%A5%EF%BC%8C%E5%BD%93%E6%89%A7%E8%A1%8C%E7%AD%96%E7%95%A5%E4%B8%BA**DuplicateWeedout**%E6%97%B6%EF%BC%8C%E4%B9%9F%E5%B0%B1%E6%98%AF%E9%80%9A%E8%BF%87%E5%BB%BA%E7%AB%8B%E4%B8%B4%E6%97%B6%E8%A1%A8%E6%9D%A5%E5%AE%9E%E7%8E%B0%E4%B8%BA%E5%A4%96%E5%B1%82%E6%9F%A5%E8%AF%A2%E4%B8%AD%E7%9A%84%E8%AE%B0%E5%BD%95%E8%BF%9B%E8%A1%8C%E5%8E%BB%E9%87%8D%E6%93%8D%E4%BD%9C%E6%97%B6%EF%BC%8C%E9%A9%B1%E5%8A%A8%E8%A1%A8%E6%9F%A5%E8%AF%A2%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E7%9A%84Extra%E5%88%97%E5%B0%86%E6%98%BE%E7%A4%BAStart%20temporary%E6%8F%90%E7%A4%BA%EF%BC%8C%E8%A2%AB%E9%A9%B1%E5%8A%A8%E8%A1%A8%E6%9F%A5%E8%AF%A2%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E7%9A%84Extra%E5%88%97%E5%B0%86%E6%98%BE%E7%A4%BAEnd%20temporary%E6%8F%90%E7%A4%BA%EF%BC%8C%E5%B0%B1%E6%98%AF%E8%BF%99%E6%A0%B7%EF%BC%9A%0A!%5B8eff7eecb6ba977dcba859da531b0fb0.png%5D(en-resource%3A%2F%2Fdatabase%2F926%3A0)%0A!%5B9467d97428c5aa3d565064577c2b407b.png%5D(en-resource%3A%2F%2Fdatabase%2F928%3A0)%0A%0A*%20**LooseScan**%0A%E5%9C%A8%E5%B0%86In%E5%AD%90%E6%9F%A5%E8%AF%A2%E8%BD%AC%E4%B8%BAsemi-join%E6%97%B6%EF%BC%8C%E5%A6%82%E6%9E%9C%E9%87%87%E7%94%A8%E7%9A%84%E6%98%AFLooseScan%E6%89%A7%E8%A1%8C%E7%AD%96%E7%95%A5%EF%BC%8C%E5%88%99%E5%9C%A8%E9%A9%B1%E5%8A%A8%E8%A1%A8%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E7%9A%84Extra%E5%88%97%E5%B0%B1%E6%98%AF%E6%98%BE%E7%A4%BALooseScan%E6%8F%90%E7%A4%BA%EF%BC%8C%E6%AF%94%E5%A6%82%E8%BF%99%E6%A0%B7%EF%BC%9A%0AEXPLAIN%20SELECT%20*%20FROM%20s1%20WHERE%20key3%20IN%20(SELECT%20key1%20FROM%20s2%20WHERE%20key1%20%3E%20'z')%EF%BC%9B%0A%0A*%20**FirstMatch(tbl_name)**%0A%E5%9C%A8%E5%B0%86In%E5%AD%90%E6%9F%A5%E8%AF%A2%E8%BD%AC%E4%B8%BAsemi-join%E6%97%B6%EF%BC%8C%E5%A6%82%E6%9E%9C%E9%87%87%E7%94%A8%E7%9A%84%E6%98%AFFirstMatch%E6%89%A7%E8%A1%8C%E7%AD%96%E7%95%A5%EF%BC%8C%E5%88%99%E5%9C%A8%E8%A2%AB%E9%A9%B1%E5%8A%A8%E8%A1%A8%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E7%9A%84Extra%E5%88%97%E5%B0%B1%E6%98%AF%E6%98%BE%E7%A4%BAFirstMatch(tbl_name)%E6%8F%90%E7%A4%BA%EF%BC%8C%E6%AF%94%E5%A6%82%E8%BF%99%E6%A0%B7%EF%BC%9A%0AEXPLAIN%20SELECT%20*%20FROM%20s1%20WHERE%20common_field%20IN%20(SELECT%20key1%20FROM%20s2%20where%20s1.key3%20%3D%20s2.key3)%EF%BC%9B%0A!%5Bce9b554df7acf0818e445c690e96b1ea.png%5D(en-resource%3A%2F%2Fdatabase%2F930%3A0)%0A%0A%23%23%20Json%E6%A0%BC%E5%BC%8F%E7%9A%84%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%0A%0A%E6%88%91%E4%BB%AC%E4%B8%8A%E8%BE%B9%E4%BB%8B%E7%BB%8D%E7%9A%84EXPLAIN%E8%AF%AD%E5%8F%A5%E8%BE%93%E5%87%BA%E4%B8%AD%E7%BC%BA%E5%B0%91%E4%BA%86%E4%B8%80%E4%B8%AA%E8%A1%A1%E9%87%8F%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E5%A5%BD%E5%9D%8F%E7%9A%84%E9%87%8D%E8%A6%81%E5%B1%9E%E6%80%A7%20%E2%80%94%E2%80%94%C2%A0%E6%88%90%E6%9C%AC%E3%80%82%E4%B8%8D%E8%BF%87%E8%AE%BE%E8%AE%A1MySQL%E7%9A%84%E5%A4%A7%E5%8F%94%E8%B4%B4%E5%BF%83%E7%9A%84%E4%B8%BA%E6%88%91%E4%BB%AC%E6%8F%90%E4%BE%9B%E4%BA%86%E4%B8%80%E7%A7%8D%E6%9F%A5%E7%9C%8B%E6%9F%90%E4%B8%AA%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E8%8A%B1%E8%B4%B9%E7%9A%84%E6%88%90%E6%9C%AC%E7%9A%84%E6%96%B9%E5%BC%8F%EF%BC%9A%0A%0A%E5%9C%A8EXPLAIN%E5%8D%95%E8%AF%8D%E5%92%8C%E7%9C%9F%E6%AD%A3%E7%9A%84%E6%9F%A5%E8%AF%A2%E8%AF%AD%E5%8F%A5%E4%B8%AD%E9%97%B4%E5%8A%A0%E4%B8%8A**FORMAT%3DJSON**%0A%0Amysql%3E%20EXPLAIN%20FORMAT%3DJSON%20SELECT%20*%20FROM%20s1%20INNER%20JOIN%20s2%20ON%20s1.key1%20%3D%20s2.key2%20WHERE%20s1.common_field%20%3D%20'a'%5CG%E3%80%82%0A%0A%0A%E5%85%88%E7%9C%8Bs1%E8%A1%A8%E7%9A%84%22cost_info%22%E9%83%A8%E5%88%86%EF%BC%9A%0A%22cost_info%22%3A%20%7B%20%22read_cost%22%3A%20%221840.84%22%2C%20%22eval_cost%22%3A%20%22193.76%22%2C%20%22prefix_cost%22%3A%20%222034.60%22%2C%20%22data_read_per_join%22%3A%20%221M%22%20%7D%0A%0A*%20read_cost%E6%98%AF%E7%94%B1%E4%B8%8B%E8%BE%B9%E8%BF%99%E4%B8%A4%E9%83%A8%E5%88%86%E7%BB%84%E6%88%90%E7%9A%84%EF%BC%9A%0Aa.%20IO%E6%88%90%E6%9C%AC%0Ab.%20%E6%A3%80%E6%B5%8Brows%20%C3%97%20(1%20-%20filter)%E6%9D%A1%E8%AE%B0%E5%BD%95%E7%9A%84CPU%E6%88%90%E6%9C%AC%0A%0A*%20eval_cost%E6%98%AF%E8%BF%99%E6%A0%B7%E8%AE%A1%E7%AE%97%E7%9A%84%EF%BC%9A%0A%E6%A3%80%E6%B5%8B%C2%A0rows%20%C3%97%20filter%E6%9D%A1%E8%AE%B0%E5%BD%95%E7%9A%84%E6%88%90%E6%9C%AC%0A%0A*%20prefix_cost%E5%B0%B1%E6%98%AF%E5%8D%95%E7%8B%AC%E6%9F%A5%E8%AF%A2s1%E8%A1%A8%E7%9A%84%E6%88%90%E6%9C%AC%EF%BC%8C%E4%B9%9F%E5%B0%B1%E6%98%AF%EF%BC%9A%0Aread_cost%20%2B%20eval_cost%0A%0A*%20data_read_per_join%E8%A1%A8%E7%A4%BA%E5%9C%A8%E6%AD%A4%E6%AC%A1%E6%9F%A5%E8%AF%A2%E4%B8%AD%E9%9C%80%E8%A6%81%E8%AF%BB%E5%8F%96%E7%9A%84%E6%95%B0%E6%8D%AE%E9%87%8F%0A%0A!%5Bfb38a25d8b1d4100a759966a4950f28d.png%5D(en-resource%3A%2F%2Fdatabase%2F934%3A0)%0A%0A%23%23%20Extented%20EXPLAIN%0A%0A%0A%E4%BD%BF%E7%94%A8EXPLAIN%E8%AF%AD%E5%8F%A5%E6%9F%A5%E7%9C%8B%E4%BA%86%E6%9F%90%E4%B8%AA%E6%9F%A5%E8%AF%A2%E7%9A%84%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E5%90%8E%EF%BC%8C%E7%B4%A7%E6%8E%A5%E7%9D%80%E8%BF%98%E5%8F%AF%E4%BB%A5%E4%BD%BF%E7%94%A8**SHOW%20WARNINGS%E8%AF%AD%E5%8F%A5**%E6%9F%A5%E7%9C%8B%E4%B8%8E%E8%BF%99%E4%B8%AA%E6%9F%A5%E8%AF%A2%E7%9A%84%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E6%9C%89%E5%85%B3%E7%9A%84%E4%B8%80%E4%BA%9B%E6%89%A9%E5%B1%95%E4%BF%A1%E6%81%AF%EF%BC%8C%E6%AF%94%E5%A6%82%E8%BF%99%E6%A0%B7%EF%BC%9A!%5B53be13a4d0f0a746d430e607a9525630.png%5D(en-resource%3A%2F%2Fdatabase%2F936%3A0)%0A%0A%0AMessage%3A%20%2F*%20select%231%20*%2F%20select%20%60xiaohaizi%60.%60s1%60.%60key1%60%20AS%20%60key1%60%2C%60xiaohaizi%60.%60s2%60.%60key1%60%20AS%20%60key1%60%20from%20%60xiaohaizi%60.%60s1%60%20join%20%60xiaohaizi%60.%60s2%60%20where%20((%60xiaohaizi%60.%60s1%60.%60key1%60%20%3D%20%60xiaohaizi%60.%60s2%60.%60key1%60)%20and%20(%60xiaohaizi%60.%60s2%60.%60common_field%60%20is%20not%20null))%0A%0A%0A%E5%A4%A7%E5%AE%B6%E5%8F%AF%E4%BB%A5%E7%9C%8B%E5%88%B0SHOW%20WARNINGS%E5%B1%95%E7%A4%BA%E5%87%BA%E6%9D%A5%E7%9A%84%E4%BF%A1%E6%81%AF%E6%9C%89%E4%B8%89%E4%B8%AA%E5%AD%97%E6%AE%B5%EF%BC%8C%E5%88%86%E5%88%AB%E6%98%AFLevel%E3%80%81Code%E3%80%81Message%E3%80%82%E6%88%91%E4%BB%AC%E6%9C%80%E5%B8%B8%E8%A7%81%E7%9A%84%E5%B0%B1%E6%98%AFCode%E4%B8%BA1003%E7%9A%84%E4%BF%A1%E6%81%AF%EF%BC%8C%E5%BD%93C**ode%E5%80%BC%E4%B8%BA1003%E6%97%B6%EF%BC%8CMessage%E5%AD%97%E6%AE%B5%E5%B1%95%E7%A4%BA%E7%9A%84%E4%BF%A1%E6%81%AF%E7%B1%BB%E4%BC%BC%E4%BA%8E%E6%9F%A5%E8%AF%A2%E4%BC%98%E5%8C%96%E5%99%A8%E5%B0%86%E6%88%91%E4%BB%AC%E7%9A%84%E6%9F%A5%E8%AF%A2%E8%AF%AD%E5%8F%A5%E9%87%8D%E5%86%99%E5%90%8E%E7%9A%84%E8%AF%AD%E5%8F%A5**%E3%80%82%E6%AF%94%E5%A6%82%E6%88%91%E4%BB%AC%E4%B8%8A%E8%BE%B9%E7%9A%84%E6%9F%A5%E8%AF%A2%E6%9C%AC%E6%9D%A5%E6%98%AF%E4%B8%80%E4%B8%AA%E5%B7%A6%EF%BC%88%E5%A4%96%EF%BC%89%E8%BF%9E%E6%8E%A5%E6%9F%A5%E8%AF%A2%EF%BC%8C%E4%BD%86%E6%98%AF%E6%9C%89%E4%B8%80%E4%B8%AAs2.common_field%20IS%20NOT%20NULL%E7%9A%84%E6%9D%A1%E4%BB%B6%EF%BC%8C%E7%9D%80%E5%B0%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